May 2001
Intermediate to advanced
720 pages
23h 24m
English
String.toLowerCase( ) Method — generate a lowercase version of a string
Flash 5
string.toLowerCase( )
The lowercase equivalent of string as a
new string. Characters without a lowercase equivalent are left
unchanged.
The toLowerCase( ) method creates a new,
lowercase version of string; it can be
used for formatting or to facilitate case-insensitive character
comparisons. The toLowerCase( ) method converts
only characters in the range A-Z (it does not convert characters with
diacritical marks such as accents and umlauts).
Note that toLowerCase( ) does not modify
string; it returns a completely new
string.
// 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
String.toUpperCase( );
Section 4.6.8.2 in Chapter 4
Read now
Unlock full access