Stay Connected

Get Your Site Submitted for Free in the World's Largest B2B Directory!

Email Address:
* URL:
*
*Indicates Mandatory Field

Terms & Conditions

Navigation

Home

About

Tutorials

Featured Sites

Newsletter

FLADownloads

Forum

Jayde

iEntry

Advertise

Contact Us







Uppercase First Letter

By Guy Watson
Expert Author
Article Date: 2004-05-24

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);


About the Author:
Guy Watson (or FlashGuru as he is also known) has been an active, well recognized figure in the Flash community for over four years, supporting the community with tutorials, source files, moderating the Flashkit forums, and running his own Flash resource Web site, FlashGuru's MX 101. Guy was one of two developers who created the ever popular, award winning zoom interface for Relevare and now runs his own company, FlashGuru LTD, which builds Flash Games & Applications for clients such as Comic Relief, Egg and Channel 4.



 
 
Newsletter Archive | Article Archive | Submit Article | Advertising Information | About Us | Contact | Site Map

FlashNewz is an iEntry.com publication
© 1998-2009 iEntry Inc. All Rights Reserved Privacy Policy Legal