Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.NET: How to camel case words that are uppercased

Tags:

string

sql

If I have a string "HELLO WORLD"

How can I lowercase every letter after the first one but keep the camel casing so: I get:

Hello World

like image 744
William Avatar asked Apr 28 '11 14:04

William


3 Answers

System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("HELLO WORLD".ToLower())

like image 150
Egor4eg Avatar answered Oct 08 '22 18:10

Egor4eg


Use Proper Case

strName = StrConv(strName, VbStrConv.ProperCase)
like image 25
JeffO Avatar answered Oct 08 '22 18:10

JeffO


You might want to take a look at this class in the .NET Framework

System.Globalization.TextInfo.ToTitleCase()

http://msdn.microsoft.com/en-us/library/system.globalization.textinfo.totitlecase.aspx

"Generally, title casing converts the first character of a word to uppercase and the rest of the characters to lowercase...."

You might have to do a .ToLower() first according to the docs.

like image 2
Ron Weston Avatar answered Oct 08 '22 18:10

Ron Weston