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 July 28th, 2016, 11:09 AM
traba5058 traba5058 is offline
Regular Contributor
 
Join Date: Jan 2012
Location: Atlanta, GA
Posts: 77
Question Changing Case & Superscript in 1 Field

I'm working on a business card that has 1 street address field. I need to change the case to uppercase & superscript the street name when it is a number.

Ex: North 44th Street should change to NORTH 44TH STREET and the th in 44th needs to superscript.

Is there a way to do this with javascript or is my only option to create formatted text resources?
Reply With Quote
  #2  
Old July 28th, 2016, 12:15 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Changing Case & Superscript in 1 Field

Use the "ToUpper" function to convert the address to uppercase. Then use a regex similar the the one below to replace any digit followed by "ST", "TH", "RD", or "ND" with the matched digit and the superscripted matched letters.
Code:
return ToUpper(Field('Street')).replace(/(\d)(ST|TH|RD|ND)/g, '$1<superscript>$2</superscript>');
__________________
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
case, superscript

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 05:33 PM.


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