Subject Re: [firebird-support] Re: Stripping non numerics from a string column
Author Alexandre Benson Smith
jrodenhi wrote:
> Rich,
> I know this violates your basic premise that you don't want to have to
> write your own function, but I would say that this is a problem that
> begs for a udf solution. One of Firebird's major selling points is
> the way that it allows you to extend it's functions with Delphi. I
> wrote a function that I think does exactly what you need in Delphi. I
> use it to strip the hyphens out of social security numbers. Here is
> the function:
> function StripChar(const sTarget: string; const sStripChar: string):
> string;
> var i: Integer;
> s: String;
> begin
> s := sTarget;
> for i := 1 to Length(sStripChar) do begin
> While Pos(sStripChar[i], s) > 0 do
> Delete(s, Pos(sStripChar[i], s), 1);
> end;
> Result := s;
> end;
> This gets included in my customized version of the tbudf dll. If that
> would fix the problem for you, I would be glad to send the dll and its
> source.
> -Jack

Quite off topic here, but just as a note, you could have used
StringReplace Delphi function

function StripChar(const sTarget: string; const sStripChar: string):string;
Result := sTarget;
For I := 1 to Length(sStripChar)
Result := StringReplace(Result, sStripChar[I], '', [rfAll];

see you !

Alexandre Benson Smith
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil