Advertisement
r4lovets

Untitled

Jan 8th, 2019
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.44 KB | None | 0 0
  1. function SearchingLastWord(var S: String): String;
  2.  
  3. var
  4.   i, j, k: Integer;
  5.   LastW: String;
  6.  
  7. begin
  8.   i := Length(S);
  9.   while not (((S[i] >= 'a') and (S[i] <= 'z')) or ((S[i] >= 'A') and (S[i] <= 'Z'))) do
  10.     Dec(i);
  11.  
  12.   k := i;
  13.  
  14.   while ((S[i] >= 'a') and (S[i] <= 'z')) or ((S[i] >= 'A') and (S[i] <= 'Z')) do
  15.     Dec(i);
  16.  
  17.   LastW := '';
  18.   for j := i + 1 to k do
  19.     LastW := LastW + S[j];
  20.  
  21.   SearchingLastWord := LastW;
  22. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement