btw
quote:
Originally posted by Matty
code:
Function talker(strInput)
If strInput <> "" then
If InStr(1, "abcdefghijklmnopqrstuvwxyz", Left(strInput, 1)) Then
talker = UCase(Left(strInput, 1)) + Right(strInput, Len(strInput) - 1)
Else: talker = strInput
End If
Else: talker = ""
End If
End Function
This can be much shorter I believe, like so:
code:
Function talker(strInput)
talker = UCase(Left(strInput, 1)) + Mid(strInput, 2)
End Function
- UCase will only uppercase characters which have an uppercased equivalent, the rest is left alone, so no need for double checking.
- The line will also convert a 0-length string to a 0-length string (used by StuffPlug-NG to check for a valid talker).