Mix case function
Does anyone have a function they built to change a name from all lower case, or all upper case to mix case?
Thanks
Scott Roth
Discussion (6)1
Comments
USER>write $zcvt("mY sImPlE eXaMpLe", "W")
My Simple Example
| W or w | Word translation: Convert the first character of each word in string to uppercase. Any character preceded by a blank space, a quotation mark ("), an apostrophe ('), or an open parenthesis (() is considered the first character of a word. Word translation converts all other characters to lowercase. Word translation is locale specific ; the above syntax rules for English may differ for other language locales. |
| S or s | Sentence translation: Convert the first character of each sentence in string to uppercase. The first non-blank character of string, and any character preceded by a period (.), question mark (?), or exclamation mark (!) is considered the first character of a sentence. (Blank spaces between the preceding punctuation character and the letter are ignored.) If this character is a letter, it is converted to uppercase. Sentence translation converts all other letter characters to lowercase. Sentence translation is locale specific ; the above syntax rules for English may differ for other language locales. |
small extension.
USER>write $TR($zcvt("mY sImPlE eXaMpLe", "W")," ")
MySimpleExampleI have run into a case where the Last Name or First Name contains a Hyphen but no spaces between the Hyphen and the split name. I have tried "S", but that seemed not to help.
Anyone have suggestions on how to handle names with a hyphen besides doing an IF statement, and Piecing the Name apart to make it Proper Case?
Thanks did not realize that Cache had a function built in for that.
replace Hyphen to tab may help
write $tr($zcvt($tr("JOHN SMITH-DOW", "-", $c(9)), "W"), $c(9), "-")
John Smith-Dowif you just want to eliminate the hyphen this may work for you:
USER>write $TR($zcvt($tr("mY-sImPlE eXaMpLe","-"," "),"W")," ")
MySimpleExample
MySimpleExample
translate hyphen to blank first and off you go