ESBPosCh Function
Returns the first Position of given Character.

Unit
QESBPCSConvert

Declaration
Function ESBPosCh(const Ch: Char; const S: string; Start: Integer = 1): Integer;

Description
Can optionally have a starting point.

Parameters
Ch Character to be searched for
String to Search within
Start Character Position at which to start. If Start < 1 then 1 is used. If Start > Length (S) then 0 is returned.

Returns
The Position of the Character, otherwise 0 is returned.

Category
Extra String Handling Routines

Implementation

function ESBPosCh (const Ch: Char; const S: string; Start: Integer = 1): Integer;
var
     I, N: Integer;
begin
     Result := 0;
     N := Length (S);
     if Start < 1 then
          Start := 1;
     if (N = 0) or (Start > N) then
          Exit;

     for I := Start to N do
     begin
          if S [I] = Ch then
          begin
               Result := I;
               Exit;
          end;
     end;
End;


HTML generated by Time2HELP
http://www.time2help.com