Subject | Re: stripping phone numbers |
---|---|
Author | Adam |
Post date | 2005-11-08T00:26:45Z |
--- In firebird-support@yahoogroups.com, "tdmfguru" <hanwel@t...> wrote:
You can create a stored procedure instead of a UDF call. The substring
call can be used to read a string character by character. You can
attempt to cast each character as an integer. If that raises an
exception, skip to the next character, otherwise add it to the output
string. You could use a BIGINT to store the RAW phone number once it
has been extracted.
Adam
>Some ideas
> Hi,
>
> I would like to strip phone numbers (with a trigger after insert in a
> second field) so I get only the raw numbers in the second field. Any
> nondigits should be stripped.
> Example: +49/6849-22415 should give 49684922415.
> Is there any posibility to solve this without creating a UDF?
>
> Thanks in advance for any ideas.
>
> Hanno Welsch
>
You can create a stored procedure instead of a UDF call. The substring
call can be used to read a string character by character. You can
attempt to cast each character as an integer. If that raises an
exception, skip to the next character, otherwise add it to the output
string. You could use a BIGINT to store the RAW phone number once it
has been extracted.
Adam