Janilabo

Janilabo | AfterEx() [Simba]

Jun 21st, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.51 KB | None | 0 0
  1. function AfterEx(s, str: string; offset: Integer): string;
  2. var
  3.   p, sL, strL: Integer;
  4. begin
  5.   sL := Length(s);
  6.   strL := Length(str);
  7.   if (sL >= strL) or (offset >= strL) then
  8.     Exit;
  9.   p := PosEx(s, str, offset);
  10.   if (p > 0) then
  11.     Result := Copy(str, (p + sL), ((1 + strL) - (p + sL)));
  12. end;
  13.  
  14. var
  15.   o: Integer;
  16.   str: string;
  17.  
  18. begin
  19.   ClearDebug;
  20.   str := 'Hmmmph, testing AfterEx(), testing AfterEx() WORKS!';
  21.   o := Pos('testing', str);
  22.   WriteLn(AfterEx('testing ', str, (o + 1)));
  23. end.
Advertisement
Add Comment
Please, Sign In to add comment