January 2002
Beginner
576 pages
13h 23m
English
Now let’s look at a function that performs exactly the same operation, but does so with much less code. This function is provided for you in the Convention database from your download. You don’t have to add or remove spaces with this function because it simply checks and changes each character as it goes. Let’s see how it works.
Function CapFirstLetter(StrInput As String)
Dim Mark As Integer, Char As String
For i = 1 To Len(StrInput)
Char = Mid(StrInput, i, 1)
If Char = " " Then
Mark = i
ElseIf i = Mark + 1 Then
Mid(StrInput, i, 1) = UCase(Mid(StrInput, i, 1))
Else
Mid(StrInput, i, 1) = LCase(Mid(StrInput, i, 1))
End If
Next i
CapFirstLetter = StrInput
End Function This entire procedure uses only ...
Read now
Unlock full access