Janilabo

Janilabo | AfterEx() [SCAR Divi]

Apr 28th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.82 KB | None | 0 0
  1. {==============================================================================]  
  2.   Explanation: Returns the string after s in str AFTER offset.                  
  3. [==============================================================================}
  4. function AfterEx(s, str: string; offset: Integer): string;
  5. var
  6.   p, sL, strL: Integer;
  7. begin
  8.   sL := Length(s);
  9.   strL := Length(str);
  10.   if ((sL < strL) and (offset < strL)) then
  11.   begin
  12.     p := PosEx(s, str, offset);
  13.     if (p > 0) then
  14.       Result := Copy(str, (p + sL), ((1 + strL) - (p + sL)))
  15.     else
  16.       Result := '';
  17.   end else
  18.     Result := '';
  19. end;
  20.  
  21.  
  22. var
  23.   o: Integer;
  24.   str: string;
  25.  
  26. begin
  27.   ClearDebug;
  28.   str := 'Hmmmph, testing AfterEx(), testing AfterEx() WORKS!';
  29.   o := Pos('testing', str);
  30.   WriteLn(AfterEx('testing ', str, (o + 1)));
  31. end.
Advertisement
Add Comment
Please, Sign In to add comment