Janilabo

Janilabo | LastPos() [Simba]

Jun 21st, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.35 KB | None | 0 0
  1. function LastPos(s, str: string): Integer;
  2. var
  3.   l, p: Integer;
  4. begin
  5.   l := Length(str);
  6.   if (Length(s) > l) then
  7.     Exit;
  8.   repeat
  9.     p := PosEx(s, str, (p + 1));
  10.     if (p > 0) then
  11.       Result := p;
  12.   until (p <= 0);
  13. end;
  14.  
  15. begin
  16.   ClearDebug;
  17.   WriteLn(LastPos('.', 'LastPos() test. The DOT is the result position. <= Over there'));
  18. end.
Advertisement
Add Comment
Please, Sign In to add comment