VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Function to capitalize all words in a string.

by vAdEr (1 Submission)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 20th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Function to capitalize all words in a string.

Rate Function to capitalize all words in a string.



' Call like this :
' Text2.Text = Capem(Text1.Text)

    Dim PosSpc As Long
    
    Mid(MyString, 1, 1) = UCase(Mid(MyString, 1, 1))
    PosSpc = InStr(MyString, " ")
    
    Do While PosSpc <> 0
        Mid(MyString, PosSpc + 1, 1) = UCase(Mid(MyString, PosSpc + 1, 1))
        PosSpc = InStr(PosSpc + 1, MyString, " ")
    Loop
    
    Capem = MyString

End Function

Download this snippet    Add to My Saved Code

Function to capitalize all words in a string. Comments

No comments have been posted about Function to capitalize all words in a string.. Why not be the first to post a comment about Function to capitalize all words in a string..

Post your comment

Subject:
Message:
0/1000 characters