Tuesday, 4 December 2012

Make first letter of each word upper case VB.NET

Make first letter of each word upper case VB.NET
VB.NET Make first letter of each word upper case


 Dim upperResult As System.Text.StringBuilder =  New StringBuilder()
'it makes first char of each word to upper,result added to stringBuilder.            
  Dim mkfu As String =  "Initiating the debate, Leader of the Opposition Sushma Swaraj contended that Prime Minister Manmohan Singh, as Leader of the Opposition in the Rajya Sabha in 2002"
                Dim words() As String =  mkfu.Split(" "c)
                Dim word As String
                For Each word In words
                    upperResult.Append(word(0).ToString().ToUpper() + word.Substring(1))
                    upperResult.AppendLine()
                Next

                Console.WriteLine(upperResult.ToString())

Output


Initiating
The
Debate,
Leader
Of
The
Opposition
Sushma
Swaraj
Contended
That
Prime
Minister
Manmohan
Singh,
As
Leader
Of
The
Opposition
In
The
Rajya
Sabha
In
2002


Make first char of each word upper case VB.NET