To the OP: are you using the AnsiString as a buffer (that contains
"several" strings)? Otherwise, using "MyString <> '' " would do
because #0 is only valid as terminator in UTF-8 too.
BTW, IIRC Delphi would generate faster code for the above construction
instead of "Length(MyString) <> 0" because of locking.
> > I thought string should be accessed from 1 not 0 for compatibility.
> > And it is what I am doing.
> >
> > for i := 1 to length(s) do ...
> >
> > so I am not sure that using s[0] is safe
> >
s[0] won't compile. Not in Delphi, at least.
> If memory serves, the [0] element was originally used to hold a byte that
> was equivalent to the string length. This was in the Turbo Pascal days
> though. I don't recall if that behavior was carried over into Delphi or
> the Delphi mode of FPC.
>
That's correct, but for ShortStrings only.
Best regards,
Flávio
_______________________________________________
fpc-pascal maillist -
[hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal