SmartPascal
LastDelimiter
Function
Find the last position of selected characters in a string SysUtils unit
 function LastDelimiter ( const Delimiters, Source : string ) : Integer;
Description
The LastDelimiter function finds the last occurence of any of a set of Delimiter characters in a Source string.
 
If found, the position is returned. Otherwise, 0 is returned.
Notes
Strings start with 1 as the first character.
Related commands
AnsiPos Find the position of one string in another
StrScan Searches for a specific character in a constant string
 
Example code : Find the last position of 1 or more characters in a string
var
  source, find : string;
  position     : Integer;

begin
  // Create a string
  source := '12345678901234567890';

  // Find the position of the last 1
  position := LastDelimiter('1', source);
  ShowMessage('The last 1 is at '+IntToStr(position));

  // Find the position of the last 2, 4 or 6
  position := LastDelimiter('246', source);
  ShowMessage('The last 2, 4 or 6 is at '+IntToStr(position));
end;
Show full unit code
   The last 1 is at 11
   The last 2, 4 or 6 is at 16