Table of Contents

String.toLowerCase( ) Method Flash 5

generate a lowercase version of a string
string.toLowerCase()

Returns

The lowercase equivalent of string as a new string. Characters without a lowercase equivalent are left unchanged.

Description

The toLowerCase( ) method creates a new, lowercase version of string; it can be used for formatting or for facilitating case-insensitive character comparisons.

Usage

Note that toLowerCase( ) does not modify string; it returns a completely new string.

Example

// Set msg to "this sentence has mixed caps!"
msg = "ThiS SenTencE Has MixED CaPs!".toLowerCase();
   
// Perform a case-insensitive comparison of two strings
function caseInsensitiveCompare (stringA, stringB) {
  return (stringA.toLowerCase() =  = stringB.toLowerCase());
}
   
trace(caseInsensitiveCompare("Colin", "colin"));  // Displays: true

See Also

String.toUpperCase( ); "The toLowerCase( ) function," in Chapter 4


Table of Contents