Click to See Complete Forum and Search --> : How to lower case and then upper case only the first latter?
I have a full name string. What I'm trying to do is to first, lower case all the latters and then, Capital only the first latter of each name.
The first part of lower case I know but How do I do the rest?
Thanks!
russell
10-20-2006, 12:28 AM
can do this in CSS: text-transform: capitalize
or can write an asp function like this
Function SentenceCase(str)
Dim ar
Dim i
ar = split(str, " ")
SentenceCase = ""
For i = 0 To ubound(ar)
SentenceCase = SentenceCase & ucase(Left(ar(i), 1)) & lcase(right(ar(i), len(ar(i))-1)) & " "
Next
SentenceCase = Trim(SentenceCase)
End Function
test out the function like this
Dim str
str = "this is a test"
Response.Write SentenceCase(str)
I.m.I
10-22-2006, 07:03 PM
nice function