0

Hi can someone give me the code how i make the first and last word of a string to Propr case
The folowing gives all words to proper case

Dim plaats As String = Replace(TextBox1.Text, "'", "''")
plaats = StrConv(plaats, VbStrConv.ProperCase)

I want, shall we say: "ohe en laak" to "Ohe en Laak" or "mülheim an der ruhr" To "Mülheim an der Ruhr"
Thanks in advise John

3
Contributors
4
Replies
23
Views
6 Months
Discussion Span
Last Post by johnnyd1963
0

Split the sentence with space and store it in an array then convert to proper case of the first and last element of that array. After that join the array elements with space.

1
            Dim vplaats() As String = Split(Replace(TextBox1.Text, "'", "''"), " ")
            vplaats(0) = StrConv(vplaats(0), VbStrConv.ProperCase)
            vplaats(vplaats.Length - 1) = StrConv(vplaats(vplaats.Length - 1), VbStrConv.ProperCase)
            Dim platts As String = Join(vplaats, " ")
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.