website promotion banner
eturnkeys
Your Ad Here
Flash & Swish  Home Flash & Swish Flash Tutorials Uppercase First Letter
rss

Uppercase First Letter

Author: Guy Watson More by this author


Personally i feel that making the first letter of a word, in a sentence and sometimes the first letter of every word in a sentence, looks better than all lowercase. When it comes to input textfields and the loading of external content, i like to make the first letter capitalised, so i created a String method, which i use regularly and i thought i would share it...

Heres the code for the method:

String.prototype.ucFirst=function()
{
if(arguments[0] == true)
{
var words=this.split(" ")
for(var w in words)
{
words[w]=words[w].ucFirst()
}
return words.join(" ")
}
return this.charAt(0).toUpperCase()+this.substring(1,this.length)
}

And heres how you would use it:

input_title="this is my title";
title=input_title.ucFirst();
input_name="guy watson";
name=input_name.ucFirst(true);

image 1



Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Uppercase First Letter"