theo wrote:
AnsiString does not have problems with #0.

Test:

var aStr:AnsiString;
begin
aStr:='test-test-test';
aStr:=StringReplace(aStr,'-',#0,[rfReplaceAll]);
//if you ouput now, you'll only see 'test'...
aStr:=StringReplace(aStr,#0,'-',[rfReplaceAll]);
//...but the text is still in the String;
Edit1.text:=aStr;
end;
Thanks. I tested it and it works.

The reference manual is a bit confusing though:
"Ansistrings are strings that have no length limit. They are reference counted and null terminated."

"i.e. a variable of type PChar is a pointer that points to an array of type Char, which is ended by a null-character (#0). "

The above quotes does not agree with the code above, which makes discovering this info a bit difficult.


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to