Author |
Message
|
chris boehnke |
Posted: Fri Jun 19, 2015 12:29 pm Post subject: Extract the numeric Values |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
Hi All,
I have to extract numeric values from an incoming telephone field. The input may come as any of below
in_phone = 123-456-7890 or 123.456.7890 or 123 456 7890 or +123 456 7890
I couldn't find any function which extracts numeric digits. Can you pls help. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jun 19, 2015 8:30 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Don't quite understand the requirement. Most dialers use a string to dial the number... So what's the purpose?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mrgate |
Posted: Sun Jun 21, 2015 8:27 pm Post subject: Re: Extract the numeric Values |
|
|
 Centurion
Joined: 28 Feb 2007 Posts: 141 Location: India
|
chris boehnke wrote: |
Hi All,
I have to extract numeric values from an incoming telephone field. The input may come as any of below
in_phone = 123-456-7890 or 123.456.7890 or 123 456 7890 or +123 456 7890
I couldn't find any function which extracts numeric digits. Can you pls help. |
Try trimming + sign from input string and use overlay function to replace - , . (or) ' ' from input string with ''. _________________ MQSeries terrorist |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun Jun 21, 2015 9:24 pm Post subject: Re: Extract the numeric Values |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
mrgate wrote: |
Try trimming + sign from input string and use overlay function to replace - , . (or) ' ' from input string with ''. |
The '+' sign on a phone number string usually indicates that the next digits are the country code for the number that follows.
Almost all the numbers held on my Mobile are prefixed with +44. This means I can phone home from anywhere in thr world that I might be without having to worry about local internatonal access codes. Those that don't have +44 have their own country code.
Personal Rant
I am still surprised that at least one International Hotel chain in the USA can't accept International Numbers on its website when making a booking. It won't accept '+44', '001144' or any other combination of those numbers. Doh!
Even worse, it will only accept USA or Canadian area codes. For example, "246" is rejected. This is the area code for Antigua.
Really sloppy design and coding for 2015. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
akil |
Posted: Mon Jun 22, 2015 2:50 am Post subject: |
|
|
 Partisan
Joined: 27 May 2014 Posts: 338 Location: Mumbai
|
If you can be sure of what non digit characters would come in , and want to use ESQL
Code: |
REPLACE(REPLACE(REPLACE(inPhone, '+', ''),'-',''),'.','')
|
For JCN, it'll be a more appropriate to use a simple regular expression, that replaces all non-digit characters , or something more accurate would be using google phone number validation library
https://github.com/googlei18n/libphonenumber _________________ Regards |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 22, 2015 4:13 am Post subject: Re: Extract the numeric Values |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
smdavies99 wrote: |
Personal Rant
I am still surprised that at least one International Hotel chain in the USA can't accept International Numbers on its website when making a booking. It won't accept '+44', '001144' or any other combination of those numbers. Doh!
Even worse, it will only accept USA or Canadian area codes. For example, "246" is rejected. This is the area code for Antigua.
Really sloppy design and coding for 2015. |
Well 001144 now would be wrong. Looks like you're getting confused...
There are parts of the world where 00 is the international prefix. [Europe]
There are parts of the world where 011 is the international prefix. [N. America]
Don't know about parts where the international prefix would be 0011...
But I do agree that an international convention such as +countrycode (area code) number would go a long way about standardizing the input field. Now if all telecom companies could subscribe to that as dialing string, that would be nice too.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
inMo |
Posted: Mon Jun 22, 2015 5:01 am Post subject: Re: Extract the numeric Values |
|
|
 Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
smdavies99 wrote: |
This means I can phone home from anywhere in the world that I might be
... "246" is rejected. This is the area code for Antigua. |
Do you have these problems based on your IIB work assignments? |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jun 22, 2015 5:45 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So you want to convert a string to a number?
Hmm. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Jun 22, 2015 7:09 am Post subject: Re: Extract the numeric Values |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
fjb_saper wrote: |
Well 001144 now would be wrong. Looks like you're getting confused...
There are parts of the world where 00 is the international prefix. [Europe]
There are parts of the world where 011 is the international prefix. [N. America]
Don't know about parts where the international prefix would be 0011...
But I do agree that an international convention such as +countrycode (area code) number would go a long way about standardizing the input field. Now if all telecom companies could subscribe to that as dialing string, that would be nice too.
Have fun  |
Sorry, too many '0''s .
I have yet to find a country where '+' does not work. There probably are some but any member of the ITU should allow '+'. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Jun 22, 2015 7:14 am Post subject: Re: Extract the numeric Values |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
inMo wrote: |
Do you have these problems based on your IIB work assignments? |
did you read what I said?
The Hotel Chain's US website won't take International numbers AND the site makes the entry of a phone number mandatory or you can't make a booking with them directly. How do you proceed then?
To me this is akin to having to use an 'in state' Zip code when buying Gas even though you have already entered the PIN number of your credit card. Sloppy programming. The CC BIN Number should tell the system that the person trying to buy Gas is not a local.
Sloppy, sloppy design and development. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
zpat |
Posted: Mon Jun 22, 2015 7:29 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
For Gas: Enter your UK (or Canada) postcode numbers (only) padded on right with zeros to five digits. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Jun 22, 2015 7:54 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
zpat wrote: |
For Gas: Enter your UK (or Canada) postcode numbers (only) padded on right with zeros to five digits. |
won't work. 27800 is not valid but 27801 is.
However one station in Southampton, Long Island will only accept NYC or Long Island Zip codes. Not Albany or upstate. Bonkers if you ask me.
Anyway, that is the USA for you. 5,000 little countries divided by a common language or two. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
zpat |
Posted: Mon Jun 22, 2015 8:12 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Can we sue for copyright infringement of our placenames?  _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jun 22, 2015 8:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
smdavies99 wrote: |
5,000 little countries |
Except for those that are bigger than several EU nations put together.
And several that are bigger than a large number of individual EU states...
hush Australia |
|
Back to top |
|
 |
inMo |
Posted: Mon Jun 22, 2015 9:03 am Post subject: Re: Extract the numeric Values |
|
|
 Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
smdavies99 wrote: |
did you read what I said?
|
Yes. You highlighted Antigua as a problem. While I didn't state it clearly, I was asking if you travel to Antigua or the like for work related maters involving IIB? |
|
Back to top |
|
 |
|