StripTChStr Routines
Returns the String with all specified trailing characters removed.

Unit
QESBPCSConvert

Overloaded Variants
Function StripTChStr(const S: string; const Ch: Char): string;
Function StripTChStr(const S: string; const Chars: TESBCharSet): string;

Declaration
Function StripTChStr(const S: string; const Ch: Char): string;

Description
Also See: StripLChStr, StripChStr

Parameters
the String from which the characters are to be removed.
Ch the character that is to be stripped off.
Chars alternatively can pass a set of Characters to remove.

Category
Extra String Handling Routines

Implementation

function StripTChStr (const S: string; const Ch: Char): string;
var
     Len: LongWord;
begin
     Len := Length (S);
     while (Len > 0) and (S [Len] = Ch) do
          Dec (Len);
     if Len = 0 then
          Result := ''
     else
          Result := LeftStr (S, Len);
End;

Declaration
Function StripTChStr(const S: string; const Chars: TESBCharSet): string;

Implementation

function StripTChStr (const S: string; const Chars: TESBCharSet): string;
var
     Len: Integer;
begin
     if Chars = [] then
          Result := S
     else
     begin
          Len := Length (S);
          while (Len > 0) and (S [Len] in Chars) do
               Dec (Len);
          if Len = 0 then
               Result := ''
          else
               Result := LeftStr (S, Len);
     end;
End;


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