Janilabo Posted May 22, 2012 Share Posted May 22, 2012 "Upgrade" function for After - with this function you can use offset. Example included. AfterEx [scar]function AfterEx(s, str: string; offset: Integer): string; var p, sL, strL: Integer; begin sL := Length(s); strL := Length(str); if (sL >= strL) or (offset >= strL) then Exit; p := PosEx(s, str, offset); if (p > 0) then Result := Copy(str, (p + sL), ((1 + strL) - (p + sL))); end; var o: Integer; str: string; begin ClearDebug; str := 'Hmmmph, testing AfterEx(), testing AfterEx() WORKS!'; o := Pos('testing', str); WriteLn(AfterEx('testing ', str, (o + 1))); end.[/scar] Quote Link to comment Share on other sites More sharing options...