楚
楚辞
Unregistered / Unconfirmed
GUEST, unregistred user!
文本文件内容如下; XX-User: tanchunxue@163.com XX-MsgType: MAIL_READ_MAIL XX-ClientMac: E0C0A0070300 XX-ServerMac: 981000000111 XX-ClientPort: 64315 XX-ServerPort: 80 XX-ClientIp: 123.243.151.171 XX-ServerIp: 202.108.5.18 XX-Protocol: HTTPMAIL 我想把XX-ClientIp: 123.243.151.171后面的123.243.151.171 读取到listview中的IP项中,目标实现:123.243.151.171程序执行结果为123.243.151.171 与123.243.151.171后面的123.243.151.171。现在想把 123.243.151.171后面的123.243.151.171。给去掉,如何办?代码如下:type TForm1 = class(TForm) btn1: TButton; OpenDialog1: TOpenDialog; lv1: TListView; procedure btn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.btn1Click(Sender: TObject);conststr='ClientIp';stra=':';vari:Integer;list :TListItem;strli:TStringList;begin if OpenDialog1.Execute then begin strli:=TStringList.Create; try strli.LoadFromFile(OpenDialog1.FileName); for I := 0 to strli.Count - 1 do begin if Pos(str,strli.Strings)>0 then begin list :=lv1.Items.Add; list.Caption :=Trim(Copy(strli.Strings,Pos(stra,strli.Strings)+1,maxint)); //这个地方如何修改了? end; end; finally strli.Free; end; end;end;