March 2019: ewertb.soundlinker.com is getting relocated to ewertb.mayasound.com, please update your bookmarks.

MEL How-To #79

Back · Previous · Next Maya

How do I perform a case-insensitive string comparison?

Wrap both strings with either "tolower()" or "toupper()" within the comparison:

string $a = "WindowsNT";
string $b = "windowsnt";

print ( $a == $b );
// Result: 0 //

print ( tolower( $a ) == tolower( $b ) );
// Result: 1 //

print ( toupper( $a ) == toupper( $b ) );
// Result: 1 //

13 January 2002