[fpc-devel] Delphi new AnsiStrings are incredibly broken :-(
Paul Ishenin
webpirat at mail.ru
Fri Oct 14 14:04:35 CEST 2011
14.10.2011 20:23, Hans-Peter Diettrich wrote:
> Apart from the mentioned implementation flaws, I came across severe
> problems with the new AnsiString *model* in general. Let's play around
> with the Pos() function, which certainly is an inevitable part of any
> stringhandling.
>
> A general function
> function Pos(SubStr: T1; Str: T2): integer;
> should return the character index of SubStr in Str, i.e. Str[i] should
> definitely be the begin of SubStr within Str.
Just think of Pos() as it only compares bytes. AnsiPos() should care
about encoding too. As I remember AnsiPos() has AnsiString arguments
instead of RawByteString and therefore the conversion will be made
before the byte compare.
Best regards,
Paul Ishenin.
More information about the fpc-devel
mailing list