Janilabo

Janilabo | After() [SCAR Divi]

Apr 28th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.68 KB | None | 0 0
  1. {==============================================================================]  
  2.   Explanation: Returns the string after s in str.                  
  3. [==============================================================================}
  4. function After(s, str: string): string;
  5. var
  6.   p, strL, sL: Integer;
  7. begin
  8.   sL := Length(s);
  9.   strL := Length(str);
  10.   if (sL < strL) then
  11.   begin
  12.     p := Pos(s, str);
  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. var
  22.   str: string;
  23.  
  24. begin
  25.   ClearDebug;
  26.   str := 'What comes after this? After() WORKS!';
  27.   WriteLn(After('this? ', str));
  28. end.
Advertisement
Add Comment
Please, Sign In to add comment