ASP equivalent to PHP Ucfirst function

This code does the same thing that Ucfirst function makes in PHP. “Ucfirst” means “Uppercase first letter”. ASP doesn’t have…

November 10, 2009

This code does the same thing that Ucfirst function makes in PHP. “Ucfirst” means “Uppercase first letter”. ASP doesn’t have this function natively:

function ucfirst(tname)
	ucfirst = ""
	tname = tname & " "
	do while instr(tname, " ")
		temp_string = left(tname, instr(tname," " ) -1)
		' ucase the first letter
		ucfirst = ucfirst & ucase(mid(temp_string, 1,1))
		' lcase for rest of word
		ucfirst = ucfirst & lcase(mid(temp_string,2)) & " "
		tname = right(tname, len(tname) - instr(tname," " ))
	loop
	'show me what i get
	ucfirst = ucfirst & ucase(mid(tname, 1,1))
	ucfirst = ucfirst & mid(tname,2)
	ucfirst = Trim(ucfirst)
end Function

Author

I'm a software engineer, an everyday web developer and a maker. I usually build sites with PHP, within or without WordPress. I build Internet of Things with Arduino and ESP8266. I'm the founder of Rockit.it and Dailybest.it and I'm actually the Chief Technical Officer of Better Days web agency.

Recommended

ASP equivalent to PHP strip_tags

I’ve found those functions around in the internet and I put them here just to remind how to strip tags…

February 9, 2010

ASP equivalent to PHP ereg_replace function

I’ve used so many time the php function ereg_replace that when I have to use ASP (’cause sometimens you have…

November 10, 2009

ASP Function to count files in a folder

This ASP function counts files of a specified extension inside a folder: this is done by creating a file system…

February 9, 2010

ASP web bot that get exchange rates

Thanks to Bank of Italy (Banca d’Italia), there are free exchange rates data that are easy to retrieve and parse,…

December 23, 2009

A new avatar generator for WordPress with get_avatar and Flathash

Brand new avatars for WordPress Gravatar service

April 7, 2017

3 ways to add author’s image in WordPress

Add author's image in WordPress without a plugin

April 5, 2017