R
RIck
I have an error on a webpage of mine since I added a function to save
the data in Proper Case-- but a smarter proper case. The page is not
displayed so I don't know where the error is or how to fix it
(obviously.) Here is the code:
Function MakeProper(var)
If Len(var) > 0 then
strV = var
bCaps = True
For i = 1 To Len(strV)
Select Case UCase(Mid(strV, i, 2))
Case " A"
bCaps = False
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 2)) &
LCase(Mid(strV, i + 2))
i = i + 2
End Select
Select Case UCase(Mid(strV, i, 3))
Case " DL", " HR", " BB", " OK"
bCaps = False
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 3)) &
LCase(Mid(strV, i + 3))
i = i + 3
End Select
Select Case UCase(Mid(strV, i, 4))
Case " MLB", " NFL", " RBI"
bCaps = False
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 4)) &
LCase(Mid(strV, i + 4))
i = i + 4
End Select
If bCaps = True Then
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 1)) &
LCase(Mid(strV, i + 1))
End If
If i <= Len(strV) Then
Select Case Asc(Mid(strV, i, 1))
Case 32, 45, 46, 47, 95
bCaps = True
Case Else
bCaps = False
End Select
End If
Next i
MakeProper= strV
else
MakeProper= var
end if
i = 0
End Function
the data in Proper Case-- but a smarter proper case. The page is not
displayed so I don't know where the error is or how to fix it
(obviously.) Here is the code:
Function MakeProper(var)
If Len(var) > 0 then
strV = var
bCaps = True
For i = 1 To Len(strV)
Select Case UCase(Mid(strV, i, 2))
Case " A"
bCaps = False
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 2)) &
LCase(Mid(strV, i + 2))
i = i + 2
End Select
Select Case UCase(Mid(strV, i, 3))
Case " DL", " HR", " BB", " OK"
bCaps = False
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 3)) &
LCase(Mid(strV, i + 3))
i = i + 3
End Select
Select Case UCase(Mid(strV, i, 4))
Case " MLB", " NFL", " RBI"
bCaps = False
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 4)) &
LCase(Mid(strV, i + 4))
i = i + 4
End Select
If bCaps = True Then
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 1)) &
LCase(Mid(strV, i + 1))
End If
If i <= Len(strV) Then
Select Case Asc(Mid(strV, i, 1))
Case 32, 45, 46, 47, 95
bCaps = True
Case Else
bCaps = False
End Select
End If
Next i
MakeProper= strV
else
MakeProper= var
end if
i = 0
End Function