| ESBLastPosCh Function | 
Unit
QESBPCSConvert
Declaration
Function ESBLastPosCh(const Ch: Char; const S: string; Start: Integer = 0): Integer;
Description
Can optionally have a starting point and the search proceeds to the beginning of the string from that Start position.
| Parameters | 
| Ch | Character to be searched for | 
| S | String to Search within | 
| Start | Character Position at which to start. If Start < 1 then Length (S) is used. If Start > Length (S) then 0 is returned. | 
Returns
The Position of the Character, otherwise 0 is returned.
Category
Extra String Handling RoutinesImplementation
 
| function ESBLastPosCh (const Ch: Char; const S: string; Start: Integer = 0): Integer;
var
     I, N: Integer;
begin
     Result := 0;
     N := Length (S);
     if Start < 1 then
          Start := N;
     if (N = 0) or (Start > N) then
          Exit;
     for I := Start downto 1 do
     begin
          if S [I] = Ch then
          begin
               Result := I;
               Exit;
          end;
     end;
End; | 
|  |