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
Routine That Capitalizes The First Character Of Ea...
Author:
Shawn Redman
E-mail:
Click to e-mail author
Submitted:
4/14/2001
Version:
VB4
Compatibility:
VB4, VB5, VB6
Category:
String Manipulation
Views:
9800
Routine That Capitalizes The First Character Of Each Word In A String.
Declarations:
Not a Declaration, but example usage: Dim strTest As String strTest = "microsoft access 97" UcaseAll strTest Debug.Print strTest 'Displays: "Microsoft Access 97"
Code:
Function UCaseAll(ByRef strArg As String) Const strSpace As String = " " Dim ID As Long 'Remove Leading and Trailing Spaces strArg = Trim$(strArg) 'Capitalize first letter in String strArg = UCase(left(strArg, 1)) & MID(strArg, 2) 'Loop through string looking for spaces and 'Capitalizing the next Character ID = 1 'Set index into string Do ID = InStr(ID, strArg, strSpace, _ vbBinaryCompare) If ID > 0 Then strArg = left$(strArg, ID) & _ UCase(left$(right$(strArg, Len(strArg) - ID), 1)) & _ MID$(strArg, ID + 2) ID = ID + 1 Else Exit Do End If Loop End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement