| String.toLowerCase( ) Method | Flash 5 |
| generate a lowercase version of a string |
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 for facilitating case-insensitive character comparisons.
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( ); "The toLowerCase( ) function," in Chapter 4