rpaterick Posted September 17, 2010 Share Posted September 17, 2010 Multiple look ups and then change or format the data. Basically looking for the following in the Last Name Field. SR to change to Sr JR to change to Jr Iii to change to III Ii to change to II I'm not sure how to put together into one code. Thanks Link to comment Share on other sites More sharing options...
esmith Posted September 21, 2010 Share Posted September 21, 2010 var LName = Field("Last"); LName = LName.replace(" SR"," Sr").replace(" JR"," Jr").replace(" iii"," III").replace(" ii"," II"); return LName; Note that I added a leading space for each version to lessen the chance of the code swapping out the letter combinations within an actual name. Link to comment Share on other sites More sharing options...
Dan Korn Posted September 21, 2010 Share Posted September 21, 2010 Note that I added a leading space for each version to lessen the chance of the code swapping out the letter combinations within an actual name. Or you can use a regular expression to accomplish this, like so: return Field("Last Name").replace(/\b[js]r\b/gi, function(w){return ToTitleCase(w);}).replace(/\bi+\b/gi, function(w){return ToUpper(w);}); Where \b in the reg ex denotes a word boundary. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.