Javascript Reference
Categories: String

javascript String toLowerCase( ), toUpperCase( )

@March 15, 2008, 1:22 a.m.
toLowerCase( ), toUpperCase( )Firefox/Netscape/NN 2 IE 3 ECMA 1  

  

Return a copy of the current string in all lowercase or uppercase letters. If you want to replace the current string with a case-adjusted version, assign the result of the method to the same string:

myString = myString.toUpperCase( );
 

It is common to use either one of these methods to create a case-insensitive comparison of two strings. This is especially convenient if one of the strings being compared is entered by a user, who may submit a variety of case situations:

if (document.forms[0].entry.value.toLowerCase( ) == compareValue) {
    ...
}
 
Parameters

None.

 
Returned Value

String.


Powered by Linode.