views:

57

answers:

2

Our customers often fill out "incorrect" formated phone-numbers. Do anyone know if there is any lib or standard to convert numbers into a more international style?

This is a Swedish example but we have customers around the globe and i don't what to manually handle implementations for everyone.

input often is like this: 0555 11122

and the wanted result is something like this: +46(0)555-11122

I can do the formating myself but different countries have different variations and systems so a C/Java/C# lib or a standard method to handle this would be great.

A: 

Sound like a job for Regular Expressions.

You can do regex conversions in almost any language. If you are doing this in C#, you would use Regex.Replace() with the proper regex expression for international numbers.

See: http://stackoverflow.com/questions/2113908/what-regular-expression-will-match-valid-international-phone-numbers

Ed B