L
liuchong
Unregistered / Unconfirmed
GUEST, unregistred user!
var AllFile:TStringList;function GetCount(S:string):string;var I:Integer;begin Result:=''
I:=LastDelimiter('本',S)-1;//这里取'本'字结果是6,用Pos结果也是6,BUG???? //I:=LastDelimiter(')',S)-3;//这里取')'正常 while I>0 do begin if (S in ['0'..'9']) then Result:=Format('%s%s',[S,Result]) else Break
Dec(I)
end;end;procedure TForm1.FormCreate(Sender: TObject);begin AllFile:=TStringList.Create
AllFile.Add('名扬票据10.8/27号7门(无碳复写32开,白、粉、绿三联100本)')
AllFile.Add('名扬票据10.8/27号7门(无碳复写32开,白、粉两联200本)')
AllFile.Add('名扬票据10.8/8-9区坡道(40开40克100本)')
AllFile.Add('名扬票据10.8/奋龙充电灯(无碳复写32开,白、粉两联100本)')
AllFile.Add('名扬票据10.8/福成金标准件(无碳复写32开,白、粉两联100本)');end;procedure TForm1.FormClose(Sender: TObject
var Action: TCloseAction);begin FreeAndNil(AllFile);end;procedure TForm1.btn1Click(Sender: TObject);var I:Integer;begin for I:=0 to AllFile.Count-1 do ShowMessage(GetCount(AllFile.Strings));end;
I:=LastDelimiter('本',S)-1;//这里取'本'字结果是6,用Pos结果也是6,BUG???? //I:=LastDelimiter(')',S)-3;//这里取')'正常 while I>0 do begin if (S in ['0'..'9']) then Result:=Format('%s%s',[S,Result]) else Break
Dec(I)
end;end;procedure TForm1.FormCreate(Sender: TObject);begin AllFile:=TStringList.Create
AllFile.Add('名扬票据10.8/27号7门(无碳复写32开,白、粉、绿三联100本)')
AllFile.Add('名扬票据10.8/27号7门(无碳复写32开,白、粉两联200本)')
AllFile.Add('名扬票据10.8/8-9区坡道(40开40克100本)')
AllFile.Add('名扬票据10.8/奋龙充电灯(无碳复写32开,白、粉两联100本)')
AllFile.Add('名扬票据10.8/福成金标准件(无碳复写32开,白、粉两联100本)');end;procedure TForm1.FormClose(Sender: TObject
var Action: TCloseAction);begin FreeAndNil(AllFile);end;procedure TForm1.btn1Click(Sender: TObject);var I:Integer;begin for I:=0 to AllFile.Count-1 do ShowMessage(GetCount(AllFile.Strings));end;