|4#24#8618210910127#Acct:0011Zone:11113009Event:Burglary17/08/0415:26:17#1706-0421:4011
這個字串 用一個MEMO裝進去
procedure TForm1.Button1Click(Sender: TObject);
var
str,count1:string;
ts:Tstringlist;
begin
str:=memo1.Text;
ts:= Tstringlist.Create;
ts.Delimiter:='|';
ts.DelimitedText:=Str;
count1:=inttostr(ts.Count-1);
showmessage(count1);
end;
顯示的結果是4 何解?!!
ts[0]是 ‘’
ts[1]是4#24#8618210910127#Acct:0011
ts[2]是Zone:11113009
ts[3]是Event:Burglary
ts[4]是17/08/045:26:17#17-06-0421:40:11
如果是數字和字母相鄰就會被分割
uj5u.com熱心網友回復:
共有5列ts.Count 應該5
count1:=inttostr(ts.Count-1); // 減去1,結果當然是4了
uj5u.com熱心網友回復:
.....ts.Delimiter:='|';
ts.Text:=Str;
應該就是你想要的了
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/52182.html
標籤:語言基礎/算法/系統設計
