Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 28th, 2012, 05:51 AM
traba5058 traba5058 is offline
Regular Contributor
 
Join Date: Jan 2012
Location: Atlanta, GA
Posts: 77
Question Formatting International Phone Numbers

We have a client we are building a new Marcomm Central Storefront for that has office worldwide. A few of the items that will be on the site are stationery (business cards, letterhead, envelops, etc.). The items with phone numbers need the phone numbers formatted for international numbers. Ex: +44 7891 549 692. The Phone Number Format Rule in Fusion Pro only has formats for domestic numbers.

Have any of you written a rule to format international phone numbers? If so, will you share it with me? If not, have you run into this situation before and resolved it a different way? If so, will you share that with me?

Thanks!
Reply With Quote
  #2  
Old November 28th, 2012, 07:29 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Formatting International Phone Numbers

This code formats numbers as you have requested. It requires that the number be 12 digits long otherwise it won't return anything.

Code:
var s = "447891549692";
s = s.replace(/\D/g,""); // remove anything but digits to strip out any pre-existing formatting
return (s.length == 12) ? "+" + Left(s,2) + " " + s.substring(2,6) + " " + s.substring(6,9) + " " + Right(s,3) : "";
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
Reply

Tags
format, international, phone

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:15 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.