snaggs Posted November 22, 2011 Share Posted November 22, 2011 i am still pretty new at this.... i have a business card that has a middle initial followed by a period.. if (Field("MiddleInitial") == "") return ""; else return ToUpper(Field("MiddleInitial") +"."); how could i write this to include overriding whatever pucntuation the purchaser may add? any help is appreciated!! Quote Link to comment Share on other sites More sharing options...
esmith Posted November 23, 2011 Share Posted November 23, 2011 if (Field("MiddleInitial") == "") return ""; else return ToUpper(Field("MiddleInitial")[color="red"].replace(/\W/g,"")[/color] +"."); The added replace method effectively removes any non alpha-numeric character. The "/\W/g" is a Regular Expression. Quote Link to comment Share on other sites More sharing options...
snaggs Posted November 23, 2011 Author Share Posted November 23, 2011 Thanks, Eric...I appreciate your help and will make sure I save and remember this code! -Ricky Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.