Convert a word like "NEW YORK" to "New York"


I have stored a string with all capital letters. For instance “NEW YORK” or “EXAMPLE OF THE EXAMPLE” and what I want to do is to convert the first letter of each word into capital letters and the rest into lowercase letter so that:

“NEW YORK” -> “New York”
“EXAMPLE OF THE EXAMPLE” -> “Example Of The Example”
“HELLO THERE HI” -> “Hello There Hi”


1 Like

First convert the whole string to lower case and then
Use the below expression in write line, if you want to convert first letter of any string to capital letter.



HI @pal1910

Use a Assign activity and use the below code to convert the String to your desired format.

StrConv(YourStringVariable.ToLower, VbStrConv.ProperCase) 

This will convert the upper case string to all lower case and then convert the first letter to Capital in each word :slight_smile:


You don’t need to convert it to Lowercase first. Like StrConv(“NEW YORK”,VbStrConv.ProperCase) should change it to “New York”.
@anil5 @Lahiru.Fernando



Is there a simple way to do this but also keep capital letters in the middle of the word if they appear? Such as for a street name that could potentially be “123 McNamara Way”?

@jpreziuso You’d have to write a special case. Convert to Proper Case, then look for cases like McNamara (now Mcnamara Way) and change the “n” to an “N”

Right. But then I would have to iterate over the original string and look for any capital letters first and then remember their position in the string somehow after using proper case. Might be tough, but thanks!