Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
This code capitilizes the first character of every...
Author:
Jacques
E-mail:
Click to e-mail author
Website:
http://www.webandsoftwaredevelopment.com
Submitted:
4/28/2001
Version:
VB6
Compatibility:
VB6
Category:
String Manipulation
Views:
10343
This code capitilizes the first character of every word in the string.
Declarations:
'none
Code:
Private Function makeCaps(strTitle As String) Dim strCaps As String 'Define temporary string variable Dim intID As Integer 'Sets the location ID intID = 1 'Set to 1 instead of zero strCaps = Trim$(strTitle) ' Removes surrounding spaces strCaps = UCase$(Left$(strCaps, 1)) & Right$(strCaps, Len(strCaps) - 1) 'Capitilizes the first character in the string Do While InStr(intID, strCaps, " ") intID = InStr(intID, strCaps, " ") + 1 'set new intID strCaps = Left$(strCaps, intID - 1) & UCase$(Mid$(strCaps, intID, 1)) & Right$(strCaps, Len(strCaps) - intID) 'Capitilizes the character after the space Loop 'repeats until all characters after spaces are capitilized makeCaps = strCaps 'makes makeCaps equal to strCaps End Function 'Example Private Sub cmdExample_Click() MsgBox makeCaps("visual basic rules!") End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement