I use TStringHelper in a Win32 application, but when I try to access a specific char or get a substring, the return values ββdo not match. If I use equivalent old string functions.
{$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; var i : Integer; s : string; begin try i:=12345678; Writeln(i.ToString().Chars[1]); // returns 2 Writeln(i.ToString().Substring(1)); //returns 2345678 s:=IntToStr(i); Writeln(s[1]); //returns 1 Writeln(Copy(s,1,Length(s)));//returns 12345678 except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end.
Question: Why are TStringHelper functions not equivalent to old string functions?
source share