In Visual Basic platform we have vbProper, ToTitle() function to convert the string into Proper Case/Title Case.
How to perform the same in UiPath?
In Visual Basic platform we have vbProper, ToTitle() function to convert the string into Proper Case/Title Case.
How to perform the same in UiPath?
UiPath uses VB.Net, so what you can do there is here as well:
requires System.Globalization namespace to be imported
CultureInfo.CurrentCulture.TextInfo.ToTitleCase("aaa bbb") //returns "Aaa Bbb"
Hi @andrzej.kniola,
Thank for your quick assistance.
Please let me know, how to import the System.Globalization namespace in UiPath.
Check here:
(note - Imports panel is next to Variables and Arguments tabs, by default below the Designer canvas)
Hi @andrzej.kniola. I tried your example and it works fine but now I would like to use a string variable instead of the âaaa bbbâ text. Iâm sure itâs very simple but Iâm not getting it. Thanks. CultureInfo.CurrentCulture.TextInfo.ToTitleCase(StringVariable)
You can do like this:
CultureInfo.CurrentCulture.TextInfo.ToTitleCase(your_str_var)
Thanks @aksh1yadav. I tried that but couldnât get it to work. It left my string as UPPERCASE. Any other ideas?
Thanks for that @aksh1yadav. I worked out the issue. The âToTitleCaseâ method doesnât work with upper case. So I used âToLowerâ to first make lower and then âToTitleCaseâ. Problem solved and many many thanks.
Yeah
From the MSDN:
Generally, title casing converts the first character of a word to
uppercase and the rest of the characters to lowercase. However, this
method does not currently provide proper casing to convert a word that
is entirely uppercase, such as an acronym.
CultureInfo.CurrentCulture.TextInfo.ToTitleCase(your_str_var.ToLower());