Hi Folks.
I don't know how Jeppe is playing around but because I want to make
sure FPC works preoperly I decided to take some time to see what
happens
Yhis is the code snippet I use in Win32 and Linux x86_64
All are Lazaur 1.0.8
Put the code under a TButton and send results to a TMemo:
procedure TFrmMain.BtnTestClick(Sender: TObject);
var
P: Integer;
str: String;
pc: PChar;
len: Integer;
begin
str :=
'http://bcms.webdev.tralala.com/testudf.php?action="">';
len := Length(str);
P := PosEx('bcms', str, 3);
Memo1.Lines.Add(Format('search "bcms" in %s: position %d', [str,
P]));
pc := nil;
ReAllocMem(pc, len + 1);
Move(PChar(str)^, pc^, len);
pc[len] := #0;
P := PosEx('bcms', pc, 3);
Memo1.Lines.Add(Format('search "bcms" in %s: position %d', [str,
P]));
end;
I've made the test with a PChar too
TMemo.Lines shows:
search "bcms" in
http://bcms.webdev.tralala.com/testudf.php?action="">:
position 8
search "bcms" in
http://bcms.webdev.tralala.com/testudf.php?action="">:
position 8
which, obviously looks correct. That's what I expect since more than
15 years (beginning with Delphi and Pos function)
Enjoy,
Antonio.
--
|
Antonio
Fortuny
Senior Software engineer
220, avenue de la Liberté
L-4602 Niederkorn
Tel.: +352 58 00 93 - 93
www.sitasoftware.lu
|
|
|
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal