I’m not aware of any method for doing this.
I’d write a String extension method like:
[code]Function Capitalize(Extends s As String)
// do your stuff here on s
// and return the capitalized string
// possibly using RegEx to find every word
// and change its initial letter to uppercase
Private Sub TitleCase(extends inText As Text)
Dim words() As Text = inText.Split(" ")
For each word as Text in Words
word = word.Uppercase.Left(1) + word.mid(1).Lowercase
next
inText = text.Join(words, " ")
End Sub
I know this is a fairly old discussion but I have a similar need. However, I’m more concerned about UX.
My reading (and fooling around with) String.Titlecase tells me it’s designed to take an input and convert it on output, regex style. But what if you want certain text fields or combo boxes to present the user with title case by default? ie. converting as they type.
You would have to implement that in the KeyDown event. If it’s the first character or if it has a space in front of it, capitalize. Otherwise, lowercase it.