Janilabo

Janilabo | Before() [Simba]

Jun 21st, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.35 KB | None | 0 0
  1. function Before(s, str: string): string;
  2. var
  3.   p: Integer;
  4. begin
  5.   if (Length(s) >= Length(str)) then
  6.     Exit;
  7.   p := Pos(s, str);
  8.   if (p > 1) then
  9.     Result := Copy(str, 1, (p - 1));
  10. end;
  11.  
  12. var
  13.   str: string;
  14.  
  15. begin
  16.   ClearDebug;
  17.   str := 'Before() WORKS! Test to see if Before() works correctly.';
  18.   WriteLn(Before(' Test', str));
  19. end.
Advertisement
Add Comment
Please, Sign In to add comment