B baisu0717 Unregistered / Unconfirmed GUEST, unregistred user! 2009-01-20 #1 各位大侠: 将字符串' 0x03,0x35,0x03,0x35,0x03,0x35,0x03,0x35,0x03,'中的除了空格、逗号和'0x'剩下的数据提取出来怎么做啊?
Z zysunit Unregistered / Unconfirmed GUEST, unregistred user! 2009-01-20 #2 你循环字符串就可以了 var str,s:string; for i:=0 to length(str) -1 do if str in [0..9] then begin s:=s+str end;s 就是你要的结果哦
你循环字符串就可以了 var str,s:string; for i:=0 to length(str) -1 do if str in [0..9] then begin s:=s+str end;s 就是你要的结果哦
有 有畏 Unregistered / Unconfirmed GUEST, unregistred user! 2009-01-20 #3 用StringReplace呀,先把所有的0x提换为空,再把最后的一个逗号删除,然后创建一个TStringList,设置Delimiter=',',最后赋值给他的DelimitedText就可以了。
W wqhatnet Unregistered / Unconfirmed GUEST, unregistred user! 2009-01-22 #5 vari:integer;abc:String;list:TStrings;beginlist:=Tstringlist.Create;abc:='n/b/c/d';list.text :=StringReplace(abc,'/',#13#10,[rfReplaceAll]);for i:=0 to list.count-1 do showMessage(list.strings);list.Destroy;end;
vari:integer;abc:String;list:TStrings;beginlist:=Tstringlist.Create;abc:='n/b/c/d';list.text :=StringReplace(abc,'/',#13#10,[rfReplaceAll]);for i:=0 to list.count-1 do showMessage(list.strings);list.Destroy;end;
Z znxia Unregistered / Unconfirmed GUEST, unregistred user! 2009-01-23 #6 Str :=' 0x03,0x35,0x03,0x35,0x03,0x35,0x03,0x35,0x03,';Str := StringReplace(Str,' ','',[rfReplaceAll]);//去掉空格Str := StringReplace(Str,',','',[rfReplaceAll]);//去掉逗号Str := StringReplace(Str,'0x','',[rfReplaceAll]);//去掉0xShowMessage(Str)
Str :=' 0x03,0x35,0x03,0x35,0x03,0x35,0x03,0x35,0x03,';Str := StringReplace(Str,' ','',[rfReplaceAll]);//去掉空格Str := StringReplace(Str,',','',[rfReplaceAll]);//去掉逗号Str := StringReplace(Str,'0x','',[rfReplaceAll]);//去掉0xShowMessage(Str)