Title Case Function In Asp
Ever wonder why there are built in functions to make stuff lower case and upper case, but not one to put something into proper case? Well we did! It's built into Visual Basic using the StrConv(string, vbProperCase) command so why can't we use it in VBScript? Well now you can.
I have made a simple function that will convert text to proper case, here is the code:
If txt <> "" Then
If x = 0 Then
TitleCase=UCase(Left(Txt,1)) & Mid(Txt,2,len(Txt)-1)
ElseIf x > 0 Then
tmp = Split(Txt,chr(32))
For I = LBound(tmp) To Ubound(tmp)
newStr = newStr & (UCase(Left(tmp(i),1)) & Mid(tmp(i),2,len(tmp(i))-1)) & " "
Set tmp = Nothing