Michael Tangorre wrote:
> Basically I just wanted to re-open my issue and it is bigger than I first imagined...
> 
> anyways, has anyone tried to calculate using any language, what country a phone 
> number relates to? Basically I thought I had it until I realized that some country 
> codes overlap if the ones being compared are 2 digits and some are 3 digits, etc....

Store all the country codes in a database. Presuming a table named 
countrycodes with the fields code and country, you can pull out the the 
right one using:

SELECT   cc.country
FROM     countrycodes cc
WHERE    cc.code = substring(<cfqueryparam cfsqltype="cf_sql_varchar" 
value="#form.phonenumber#"> FROM 1 FOR character_length(cc.code))
ORDER BY character_length(cc.code) DESC

Check the manual if your database does not support this standard SQL 
syntax. If it pulls out more as one country, you need the first one.

Remember you still need to normalize the phonenumbers first. I strongly 
recommend to use the format from ITU E.164 for storing phone numbers, it 
is forward compatible.

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Host with the leader in ColdFusion hosting. 
Voted #1 ColdFusion host by CF Developers. 
Offering shared and dedicated hosting options. 
www.cfxhosting.com/default.cfm?redirect=10481

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to