| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi!
I have used the below code to change the case of text to Proper Case. I received the following error. Please help! Error: Microsoft VBScript compilation error '800a0400' Expected statement /AddMaillist2.asp, line 10 Public Function ToTitleCase(inString) As String--------------------------------------^Code I used: <%Public Function ToTitleCase(inString) As String On Error GoTo Err_ToTitleCase Dim i As Integer Dim thisChar As String Dim tempString As String Dim stringLen As Integer Dim newWord As Boolean If (IsNull(inString)) Then ToTitleCase = "" GoTo Exit_ToTitleCase End If stringLen = Len(inString) inString = LCase(inString) If (stringLen > 0) Then tempString = "" newWord = True For i = 1 To stringLen thisChar = Mid(inString, i, 1) If (IsAlpha(thisChar) = True) Then If (newWord = True) Then tempString = tempString & UCase(thisChar) newWord = False Else tempString = tempString & thisChar End If 'newWord = True Else 'character is not alpha tempString = tempString & thisChar newWord = True End If Next i 'Loop through string ToTitleCase = tempString End If 'stringLen = 0 Exit_ToTitleCase: Exit Function Err_ToTitleCase: MsgBox Err.Number & " : " & Err.Description Resume Exit_ToTitleCase End Function %> ![]() |
|
#2
|
||||
|
||||
|
|
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Change the Case of Text to Proper |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|