Jump to content

Replaceing letter


Recommended Posts



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?





Link to comment
Share on other sites



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.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...