VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Take a string, and convert all words to have the first letter be a capital. Example: Take: “b

by Dmitry (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 7th February 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Take a string, and convert all words to have the first letter be a capital. Example: Take: “blah blah blah” Make: “Blah Blah

Rate Take a string, and convert all words to have the first letter be a capital. Example: Take: “b



' Put this code into a module of your choice

Dim TextinS() As String
Dim Letter As String
Dim FinalWord As String
Dim MyItem As Integer
Dim c As Integer

TextinS = Split(TEXTIN, " ")

MyItem = UBound(TextinS)
For c = 0 To MyItem

Letter = Left(TextinS(c), 1)
Letter = UCase(Letter)
FinalWord = (Right(Letter, 1)) & Mid(TextinS(c), 2)
TextinS(c) = FinalWord

If UBound(TextinS) = c Then
    UpAllWords = UpAllWords & TextinS(c)
Else
    UpAllWords = UpAllWords & TextinS(c) & " "
End If

Next c

End Function

Download this snippet    Add to My Saved Code

Take a string, and convert all words to have the first letter be a capital. Example: Take: “b Comments

No comments have been posted about Take a string, and convert all words to have the first letter be a capital. Example: Take: “b. Why not be the first to post a comment about Take a string, and convert all words to have the first letter be a capital. Example: Take: “b.

Post your comment

Subject:
Message:
0/1000 characters