Formatting phone numbers
Our customers often fill out "incorrect" formatted 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:开发者_Python百科 +46(0)555-11122
I can do the formatting 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.
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: What regular expression will match valid international phone numbers?
精彩评论