CoderZone.org

Category: >> ASP/VB Code >> Convert a String to Title Case in ASP Bookmark and Share

<< lastnext >>

Snippet Name: Convert a String to Title Case in ASP

Description: ASP doesn't have a StrConv function like VB does. TInstead, tis Str2TitleCase() function will do the work of converting a string of text to "Title Case".

Also see:
» Convert Minutes to Days, Hours, an...
» Resize and convert an image to a P...
» Convert text to image in php
» Convert RGB to Hex with ASP
» Convert Extensions To Lowercase
» Tabs-To-Space Converter
» Convert Unix time string to a date...
» Convert Dollars And Cents Value to...
» LDAP Timestamp Converter
» Convert entities into normal chara...
» Convert Seconds to Hours:Minutes:S...
» Convert UK Dates To mySQL Format D...
» Convert miles to feet, feet to mil...
» Converting Rows to Columns
» Alternate Title Case function
» CONVERT
» Convert text to soundex
» Convert between Decimal, Binary, O...
» Convert LONGs to LOBs
» Convert Minutes to Hours
» Convert Hours to Minutes
» Basic currency conversion Convert...
» Update/convert DB field to upperca...
» Convert 12 to 24 hour time and vic...
» Convert Hex to Decimal, Decimal to...
» Convert minutes to hours #2
» Convert minutes to hours #1
» Convert HTML to plain text
» Convert BBCode Tags

Comment: (none)

Author:
Language: ASP
Highlight Mode: ASP
Last Modified: December 04th, 2010

<%
Function Str2TitleCase(stValue)
 
	iPos = 1
	Do While InStr(iPos, stValue, " ", 1) <> 0
		iSpace = InStr(iPos, stValue, " ", 1)
		sTemp = sTemp & UCase(Mid(stValue, iPos, 1))
		sTemp = sTemp & LCase(Mid(stValue, iPos + 1, _
                      iSpace - iPos))
		iPos = iSpace + 1
	Loop
 
	sTemp = sTemp & UCase(Mid(stValue, iPos, 1))
	sTemp = sTemp & LCase(Mid(stValue, iPos + 1))
 
	Str2TitleCase = sTemp
End Function
 
'Example Usage:
'sValue = Str2TitleCase("THIS is a TeSt of the tItle Case 'fUnction")
'response.write sValue "This Is A Test Of The Title Case Function"
 
%>
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 11