| StripChFromStr Routines |
Unit
QESBPCSConvert
| Overloaded Variants |
| Function StripChFromStr(const S: string; const Ch: Char): string; |
| Function StripChFromStr(const S: string; const Chars: TESBCharSet): string; |
Declaration
Function StripChFromStr(const S: string; const Ch: Char): string;
Description
Also see: StripChStr , StripTChStr, StripLChStr
| Parameters |
| S | the String to process. |
| Ch | the character to remove. |
| Chars | alternatively can pass a set of Characters to remove. |
Category
Extra String Handling RoutinesImplementation
function StripChFromStr (const S: string; const Ch: Char): string;
var
LenS, N, I: Integer;
begin
LenS := Length (S);
SetLength (Result, LenS);
N := 0;
for I := 1 to LenS do
begin
if S [I] <> Ch then
begin
Inc (N);
Result [N] := S [I];
end;
end;
SetLength (Result, N);
End; |
Declaration
Function StripChFromStr(const S: string; const Chars: TESBCharSet): string;Implementation
function StripChFromStr (const S: string; const Chars: TESBCharSet): string; var LenS, N, I: Integer; begin if Chars = [] then Result := S else begin LenS := Length (S); SetLength (Result, LenS); N := 0; for I := 1 to LenS do begin if not (S [I] in Chars) then begin Inc (N); Result [N] := S [I]; end; end; SetLength (Result, N); end; End; |
|
|