Subject | Re: [firebird-support] stripping phone numbers |
---|---|
Author | Hans |
Post date | 2005-11-08T01:44:35Z |
Maybe this helps, a code fragment to cleanup up product names
PROCEDURE ZAP_NAME( PROD_NAME VARCHAR( 40 ) )
RETURNS ( ZAPPED_PROD_NAME VARCHAR( 40 ) )
AS
DECLARE VARIABLE I INTEGER;
DECLARE VARIABLE N INTEGER;
DECLARE VARIABLE C CHAR;
BEGIN
ZAPPED_PROD_NAME = '';
PROD_NAME = UPPER(PROD_NAME);
I = 1;
N = STRLEN(PROD_NAME);
WHILE (I <= N) DO
BEGIN
C = SUBSTR (PROD_NAME,I,I);
IF (C IN ('A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'0','1','2','3','4','5','6','7','8','9','.') ) THEN
ZAPPED_PROD_NAME = ZAPPED_PROD_NAME || C;
I = I + 1;
END
SUSPEND;
END
PROCEDURE ZAP_NAME( PROD_NAME VARCHAR( 40 ) )
RETURNS ( ZAPPED_PROD_NAME VARCHAR( 40 ) )
AS
DECLARE VARIABLE I INTEGER;
DECLARE VARIABLE N INTEGER;
DECLARE VARIABLE C CHAR;
BEGIN
ZAPPED_PROD_NAME = '';
PROD_NAME = UPPER(PROD_NAME);
I = 1;
N = STRLEN(PROD_NAME);
WHILE (I <= N) DO
BEGIN
C = SUBSTR (PROD_NAME,I,I);
IF (C IN ('A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'0','1','2','3','4','5','6','7','8','9','.') ) THEN
ZAPPED_PROD_NAME = ZAPPED_PROD_NAME || C;
I = I + 1;
END
SUSPEND;
END
----- Original Message -----
From: "tdmfguru" <hanwel@...>
To: <firebird-support@yahoogroups.com>
Sent: Monday, November 07, 2005 10:52 AM
Subject: [firebird-support] stripping phone numbers
> 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
>
>
>
>
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>