Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Before(s, str: string): string;
- var
- p: Integer;
- begin
- if (Length(s) >= Length(str)) then
- Exit;
- p := Pos(s, str);
- if (p > 1) then
- Result := Copy(str, 1, (p - 1));
- end;
- var
- str: string;
- begin
- ClearDebug;
- str := 'Before() WORKS! Test to see if Before() works correctly.';
- WriteLn(Before(' Test', str));
- end.
Advertisement
Add Comment
Please, Sign In to add comment