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

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 16th, 2008, 09:14 AM
jonte jonte is offline
Forum n00b
 
Join Date: Oct 2008
Posts: 3
Default Replaceing letter

Hi

I use the rule "Case selection for a name field Rule" to compose a email adress from a name field. Just to get all letter lowercase. But i also like to make a switch och change of non legel email letters like å or ö to a and o. Is there any code that i can add to this rule to make this happen?

Regards

Jonte
Reply With Quote
  #2  
Old October 16th, 2008, 01:21 PM
DSweet's Avatar
DSweet DSweet is offline
Senior Contributor
 
Join Date: Sep 2008
Location: Oberlin, Ohio
Posts: 240
Default Re: Replaceing letter

Hi,

This was a posting that I did on the previous forum. I hope it can give you an enough of an idea to help you. As I mentioned in the previous posting, this function only worked on the PC and not on my Mac.



Date: Mon, 23 Jun 2008 14:16:20 -0400
Author: "David Sweet"
Subject: Returning an accent mark using all caps rule
...

I think that this is another situation where Mac and PC speak a different language. I just created this function and it works on my PC, but not quite on my Mac...

function foreignUpper(str) {
var strOut = "";
var strLength = Len(str);

for( var x = 1; x <= strLength; x++)
{
var strTest = Mid(str, x, 1);
if ((Asc(strTest) > 224) && (Asc(strTest) < 254)) {
var newStr = Asc(strTest) - 32;
strOut += Chr(newStr);
}
else {
strOut += ToUpper(strTest);
}
}
return strOut;
}


Basically what I'm doing is sending a string of characters to a function. Then the function tests and converts it one character at a time. If the ASC range of a character falls within the values of 224 and 254, then that specific character is a lowercase accented foreign character. If it is, then subtract 32 from that ASC value and append the CHR equivalent of that new character to my output string. If not, then use the FP function "ToUpper" to switch the case of that character. The result on my PC gives me the correct values for upper and lower cases foreign characters with accents - subtracting 32 given the uppercase value, and adding 32 gives the lowercase equivalent.

The problem is that I don't have any printouts of the Mac Roman character "ASCII" values for the 255 characters, so I don't know the relationship that occurs to add or subtract the correct amount. To be truthful, I don't even know if Macs have the same ASCII-255 character range with any similar relationship at all, so when I tried this on my Mac, the resulting output was not what I expected. The "English" lowercase characters came out fine, but the foreign characters did not. Also there are some entities on the Mac that will not print out at all through FusionPro. Printable has listed them in one of their manuals around page 74 "Entities" - I think it's their one on Tagging.

The best suggestion that I can give you is to start with the above function, then maybe look at the rules functions that Printable has in their program for "ToUpper" or "ToLower" and see if you can find the relational pattern on the Mac.

Hope this helps you out. Good Luck.
__________________
David A. Sweet
Variable Data Specialist
HKM Direct Market Communications
Windows 7, Acrobat 10.x
FusionPro Desktop and Server 10.0.26
Reply With Quote
Reply

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 08:43 PM.


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