type
TCharSet = set of Char;
function StripNonConforming(const S: string;
const ValidChars: TCharSet): string;//Removes characters you tell it to.
var
DestI: Integer;
SourceI: Integer;
begin
SetLength(Result, Length(S));
DestI := 0;
for SourceI := 1 to Length(S) do
if S[SourceI] in ValidChars then
begin
Inc(DestI);
Result[DestI] := S[SourceI]
end;
SetLength(Result, DestI)
end;
function StripNonNumeric(const S: string): string;//Removes numbers
begin
Result := StripNonConforming(S, ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
end;
Le Jingle
06-03-2012, 05:36 PM
E: Ninja'd
Plus there's plentiful string commands here too;
http://villavu.com/forum/showthread.php?t=82205
ilklhl1Lihl1
06-03-2012, 05:37 PM
thanks for the two answers
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.