localeCompare Method

Returns a value indicating whether two strings are equivalent in the current locale.

function localeCompare(stringExp : String) : Number

Arguments

  • stringExp
    Required. String to compare against the current string object.

Remarks

The localeCompare performs a locale-sensitive string comparison of the current string object and the stringExp and returns -1, 0, or +1, depending on the sort order of the system default locale.

If the current string object sorts before stringExp, localeCompare returns –1; if the current string sorts after stringExp, +1 is returned. A return value of zero means that the two strings are equivalent.

Requirements

Version 5.5

Applies To:

String Object

See Also

Reference

toLocaleString Method