This code is used for convert text to Upper case for the first character which is separated by spac
This code is used for convert text to Upper case for the first character which is separated by space.
Rate This code is used for convert text to Upper case for the first character which is separated by spac
(1(1 Vote))
Private Function Convert_Text(Str As String) As String
Dim cutStr As String
Dim spLocation As Integer 'for space location
Dim strConvert As String
Str = Trim(Str)
If Str = "" Then Exit Function
If InStr(1, Str, " ") Then
spLocation = InStr(1, Str, " ")
'cutStr string from first space backward
cutStr = Trim(Mid(Str, 1, spLocation - 1))
'cut string that remains from the cutStr
Str = Trim(Mid(Str, spLocation + 1, Len(Str) - spLocation))
strConvert = UCase(Mid(cutStr, 1, 1)) + _
LCase(Mid(cutStr, 2, Len(cutStr) - 1))
'call function Convert_Text as recursive
Convert_Text = strConvert + " " + Convert_Text(Str)
Else
Convert_Text = UCase(Mid(Str, 1, 1)) + LCase(Mid(Str, 2, Len(Str) - 1))
End If
End Function
Private Sub Command1_Click()
Text1.Text = Convert_Text(Text1.Text)
End Sub
This code is used for convert text to Upper case for the first character which is separated by spac Comments
No comments yet — be the first to post one!
Post a Comment