<%
Public Function Correctcase(Thestring)
Dim iCounter 'As Integer
If Thestring <> "" Then
Thestring = LCase(Thestring)
Thestring = UCase(Left(Thestring, 1)) + Right(Thestring, Len(Thestring) - 1)
For iCounter = 1 To Len(RTrim(Thestring)) - 1
If
Mid(Thestring, iCounter, 1) = " " Or Mid(Thestring, iCounter, 1) = "-"
Or Mid(Thestring, iCounter, 1) = "'" Or Mid(Thestring, iCounter, 1) =
"." Then
Thestring = Left(Thestring, iCounter) + UCase(Mid(Thestring, iCounter +
1, 1)) + Right(Thestring, Len(Thestring) - (iCounter + 1))
End If
Next
Correctcase = Thestring
End If
End Function
Dim strText
Dim strNew
Dim tmpString
Dim i
Dim splitText
splittext = "the question now is, If i have a text written ALL IN
CAPITAL LETTERS, I want to change it into small case But reserve the
first letter in each word Capital."
strText = Split(splittext, " ", -1 , 1)
For i = 0 To UBound(strText) - 1
tmpString = strText(i)
strNew = strNew & Correctcase(tmpString) & " "
Next
Response.Write(strNew)
%>
|