Code:
Dim strName As String strName = TextBox1.Text strName = StrConv(strName, vbProperCase) Label1.Text = strName
Example : Input > " SANDEEP PREMCHANDANI "
Output > I want "Sandeep Premchandani" (Single space between Sandeep and Premchandani)
Dim strName As String strName = TextBox1.Text strName = StrConv(strName, vbProperCase) Label1.Text = strName
Dim strName, str, strUserName As String Dim arrName As String() strUserName = "" strName = TextBox1.Text arrName = strName.Split("bbb") For Each str In arrName If str.Length > 0 Then strUserName += str & "" End If Next strUserName = StrConv(strUserName, vbProperCase) Label1.Text = strUserName
Dim str As String = "A bunch of spaces and tabs are inserted through out this String!" 'Please note that "\s+" matches "one or more white space character" Dim cleanedStr As String = RegularExpressions.Regex.Replace(str, "\s+", " ") MessageBox.Show(str) MessageBox.Show(cleanedStr)
Comment