Delphi中String当数组用,多余的空格去除
作者:互联网
var
s:string;
begin
SetLength(s,256);
GetWindowsDirectory(PChar(s),256);
ShowMessage(IntToStr(Length(s))); //Length(s) 256
ShowMessage(IntToStr(StrLen(PChar(s))));//StrLen(PChar(s))10
//SetLength(s,StrLen(PChar(s))); //没有这句,会有一堆的空格
ShowMessage(s);
end;
标签:PChar,String,256,Delphi,IntToStr,空格,Length,ShowMessage,StrLen 来源: https://www.cnblogs.com/dmqhjp/p/14890375.html