9

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

bobs
  • 21,844
  • 12
  • 67
  • 78
William
  • 113
  • 1
  • 1
  • 4

5 Answers5

15

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

Egor4eg
  • 2,678
  • 1
  • 22
  • 41
  • nice any way to do this in sql? – William Apr 28 '11 at 15:05
  • You can try http://blog.sqlauthority.com/2007/02/01/sql-server-udf-function-to-convert-text-string-to-title-case-proper-case/ or http://stackoverflow.com/questions/230138/sql-server-make-all-upper-case-to-proper-case-title-case But I suggest to do this on the client. SQL just doesn't have the functions to do this eaisly. – Egor4eg Apr 29 '11 at 08:32
5

Use Proper Case

strName = StrConv(strName, VbStrConv.ProperCase)
JeffO
  • 7,957
  • 3
  • 44
  • 53
2

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.

Ron Weston
  • 280
  • 2
  • 16
1

There is an option to convert a string to title casing, in vb.net.

Try this code. It should work fine.

Dim title as String = "converted to title case"

Console.WriteLine(StrConv(title, VbStrConv.ProperCase))
jitendragarg
  • 945
  • 1
  • 14
  • 54
0

Try this:

StrConv("SOME TEXT TO CONVERT", VbStrConv.ProperCase)

Also check out this article with better code examples:

http://www.vbforums.com/showthread.php?t=555587

ThinkerIV
  • 183
  • 1
  • 9