You could just use a regex that replaced anything that wasn't a number.
The only tricky thing with this is when you get into international.  If
it's local, you could just strip out all non-numeric characters and see
if the string length is 10 and if not, show an error to the user.  Then
on output from the DB, you could use the first 3 numbers in () or
however you want to display it and put dashes in appropriately.  It all
depends on what kind of numbers you want to allow.

John

-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 06, 2004 10:50 AM
To: CF-Talk
Subject: RE: Strip ()-

you would do some fancy regex, and im sure someone will chime in

however, ray forgot the ()'s to remove

you could kludge it like this...

replace(replace(replace(my_string,
'-','','ALL'),')','','all'),'(','','all')))

tw

-----Original Message-----
From: Ray Champagne [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 06, 2004 10:44 AM
To: CF-Talk
Subject: Re: Strip ()-

Replace(my_string, '-','','ALL')

At 10:37 AM 4/6/2004, you wrote:
>On a phone number field I want to make sure that users haven't added
()-.
>I figure the easiest way is to strip it off before entering it into the

>database.
>How would I set that?
>Thanks,
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to