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…

Novembre 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

PHP expert. Wordpress plugin and theme developer. Father, Maker, Arduino and ESP8266 enthusiast.

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…

Febbraio 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…

Novembre 10, 2009

Find values recursively inside complex json objects in PHP

A PHP function to to quickly search complex, nested php structures for specific values.

Dicembre 18, 2022

Test page for Bright Links plugin

To test the plugin hover your mouse to a link, or tap the link on mobile device.

Dicembre 4, 2022

WP doesn’t send email? try this

Snippets for sending emails with Wordpress

Febbraio 8, 2020

Highlight text for search results in PHP

Useful code to highlight text occurences in search results or in a text. How to highlight text in a string…

Settembre 2, 2016