Join us on Facebook!
20
Jun

Title Case Function In Asp

by admin 4243 views 0 Comments and 0 Rections

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:

Function TitleCase(Txt)
If txt <> "" Then
Txt=LCase(CStr(Txt))
x=Instr(1,Txt,chr(32),vbTextCompare)
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)) & " "
Next
newStr=Left(newStr,Len(newStr)-1)
TitleCase=newStr
End If
Set tmp = Nothing
End If
End Function
More Posts in "Tutorials"

Comments

blog comments powered by Disqus

Feed Subscription

Get daily inboxed with latest news, reviews and tutorials. Signup now it's free :)



Planetmaks on Twitter

Follow PlanetMaks on Facebook

Recent Comments

Powered by Disqus

Tags

32Bit 64Bit 7 Admin Tool Admin Tools Admin-Tool Admin-Tools AdminTool Adobe Adware All-in-One Anti-Spyware Anti-Virus Apple Backup Tools Browser Browsers Changing Default Directory Codec Data Recovery Download Manager Downloads Drive Utilities Driver Drivers Firefox Flash Freeware Google Graphics Internet Tool Internet-Tool Messaging Microsoft Microsoft Tool Micsellonous Monitoring Multimedia Networking News NVidia Office Tool Office-Tool PC Suite Press Release Registry Samsung Security Shareware Software Softwares Tutorials Vista Windows Windows 7 Windows 8