Author: Christian Cristofori
Sometime Pos is not enough, because you need to find the position of the first
character of a sub string in a string from the end of that string. There's the
solution.
Answer:
1 2 function RPos(Substr: string; S: string): Integer;
3 var4 i: Integer;
5 begin6 Result := 0;
7 if ((Length(S) > 0) and (Length(Substr) > 0)) then8 if (Length(S) >= Length(Substr)) then9 for i:= (Length(S) - Length(Substr)) downto 1 do10 if (Copy(S, i, Length(Substr)) = Substr) then11 begin12 Result := i;
13 Exit;
14 end;
15 end;