0 Members and 1 Guest are viewing this topic.
gp.pas
(21:31:02) /test getpiece (x.x.x.x)(21:31:02) 50000 x GetPiece('jedd66f jj92jhfjdh hmmnkjdkjf kjk1ssxjkj1 3lk4l3111 3335', ' ', 3); = 00:00:00,507(21:31:06) /test getpiece2 (x.x.x.x)(21:31:13) 50000 x GetPiece2('jedd66f jj92jhfjdh hmmnkjdkjf kjk1ssxjkj1 3lk4l3111 3335', ' ', 3); = 00:00:05,986(21:31:13) /test getword (x.x.x.x)(21:31:18) 50000 x GetWord('jedd66f jj92jhfjdh hmmnkjdkjf kjk1ssxjkj1 3lk4l3111 3335', 3); = 00:00:05,030
Lil bit faster
function GetPiece(Str, Reg: string; Number: byte): string;var Res: TStringList;begin try Res := File.CreateStringList; SplitRegExpr(QuoteRegExprMetaChars(Reg), Str, Res); Result:=Res.Strings[Number]; except Result:=''; finally Res.Free; end;end;