Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 05, 2016, 02:47:55 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: USA/Europe telephone "mask" in a text file  (Read 2061 times)

IconBoy

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 35
    • View Profile
    • Donate to Member
USA/Europe telephone "mask" in a text file
« on: March 25, 2007, 04:11:25 PM »
I have exported my contacts into a plain text file and would like to apply a "mask" to certain numbers from certain countries so that they are in a uniform/set pattern e.g:
Below are three USA numbers with different pattern to their numbers.
+1 234 5678901
+13456789012
+1-4567890123
I would like the numbers to end up looking uniformly in the format +c-aaa-nnn-nnnn so the result would be:
+1-234-567-8901
+1-345-678-9012
+1-456-789-0123

Below are three UK numbers with different pattern to their numbers.
+44-7890-123-456
+44 790 123 4567
+44-788-0123456
I would like the numbers to end up looking uniformly in the format +cc-aaaa-nnnnnn so the result would be:
+44-7890-123456
+44-7901-234567
+44-7880-123456

Is there a coding snack that could accomplish this on a text file with numbers in them?
The reason I ask is because my number formatting goes for a loop depending on whether I edit the number in Outlook, on the phone or PDA. If I synchronise, it may be correct on the phone but then the computer contacts either lose some dashes or get spaces added instead of dashes. I know the numbers and dashes don't make a difference on a phone when dialling, but it makes it easier for me to read either on the phone, PDA or computer.
Can anyone help rescue my from my contacts formatting (or lack thereof) nightmare...?
« Last Edit: March 25, 2007, 04:15:19 PM by IconBoy »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: USA/Europe telephone "mask" in a text file
« Reply #1 on: March 25, 2007, 05:25:15 PM »
Well.. This isn't really a coding snack. I think what you're looking for is a text replacement tool.
A good online option is www.rereplace.com, a site by a fellow DC member, allen.
I personally love Vim, a text editor. But that's kind of too advanced for this task.