本文主要是介绍TStringList类的字符分割有问题,另贴一替代函数,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
TStringList类的字符分割有问题,当字符串中有#0到空格之间的任一字符时,都会被当作分割符,郁闷,另贴一替代函数:function SplitString(Source, Deli: string ): TStringList;
var
EndOfCurrentString: byte;
StringList:TStringList;
begin
StringList:=TStringList.Create;
while Pos(Deli, Source)>0 do
begin
EndOfCurrentString := Pos(Deli, Source);
StringList.add(Copy(Source, 1, EndOfCurrentString - 1));
Source := Copy(Source, EndOfCurrentString + length(Deli), length(Source) - EndOfCurrentString);
end;
Result := StringList;
StringList.Add(source);
end;
这篇关于TStringList类的字符分割有问题,另贴一替代函数的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!