tempstr:='A*1*2*7*9*11';
i:=0;
while pos('*',tempstr)>0 do
begin
list[i]:=copy(tempstr,1,pos('*',tempstr)-1);
tempstr:=copy(tempstr,pos('*',tempstr)+1,length(tempstr));
inc(i);
end;
i:=0;
while pos('*',tempstr)>0 do
begin
list[i]:=copy(tempstr,1,pos('*',tempstr)-1);
tempstr:=copy(tempstr,pos('*',tempstr)+1,length(tempstr));
inc(i);
end;
解决方案 »
- 多线程中为什么一用TStrings、TStringList等就出错??
- cxgrid怎么得到筛选后的记录数?
- 求DELPHI语句:想遍历"2005-1-15"---"2007-1-28"之间的天数!如何做?
- D7中用IdTCPClient控件在断开是出现错误IdTelnet控件在断开是出现错误, 错误是说(raised exception class EIdCloseSocket with message
- 请教如何应用dll中的数据结构?
- 我要从服务器中下载一个文件流什么作???在线等.....................
- 如何在fastreport中把没有内容的记录不显示和打印出来?
- 如何实现win2000和xp下关机功能!
- 在设计菜单的时候,如何去掉这个东东??
- 一个很不错的学习资料网站,有很多教学视频资料下载,晚了就没了.
- 我的DELPHI启动之后,工具栏显示有问题,有答必给分。
- 关于DELPHI共享打印的问题
var
I, L: Integer;
Left: AnsiString;
begin
Assert(List <> nil);
List.Clear;
L := Length(Sep);
I := Pos(Sep, S);
while (I > 0) do
begin
Left := StrLeft(S, I - 1);
List.Add(Left);
Delete(S, 1, I + L - 1);
I := Pos(Sep, S);
end;
if S <> '' then
List.Add(S);
end;
同意 chechy(chechy) !!StrToStrings(S: AnsiString; Sep: AnsiString; const List: TStrings);
调用就行了的。
var
a: TStrings;begin
a := TStringList.Create;
StrToString('A*1*2*7*9*11', '*', a);
然后a里面就是A, 1, 2, 7, 9, 11另补:
function StrLeft(const S: AnsiString; Count: Integer): AnsiString;
begin
Result := Copy(S, 1, Count);
end;