by Thejan J Rajapakshe (7 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 3rd January 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Capitalize the first letter of each word in a string
API Declarations
[email protected]
t$ = Text1.Text 'the string
If t$ <> "" Then
Mid$(t$, 1, 1) = UCase$(Mid$(t$, 1, 1))
For i = 1 To Len(t$) - 1
If Mid$(t$, i, 2) = cr$ Then Mid$(t$, i + 2, 1) = UCase$(Mid$(t$, i + 2, 1))
If Mid$(t$, i, 1) = " " Then Mid$(t$, i + 1, 1) = UCase$(Mid$(t$, i + 1, 1))
Next
Text1.Text = t$
End If