JavaScript Reference/Javascript Methods/localeCompare — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:22, 26 мая 2010
"localeCompare()" Example
<html>
<body>
<button onclick="var myS = new String("Sample String");
alert(myS.localeCompare("Sample String"));">compare string by locale</button>
</body>
</html>
"localeCompare()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |String |
+----------------+--------------------------------------------------------------+
"localeCompare()" Syntax, Parameters and Note
Note:
Compares the String value to the system"s locale settings.
Returns
0 match
-1 no match, and the parameter value comes before
the String object"s value in the locale sort order
1 no match, and the parameter value comes after the
String object"s value in the locale sort order
Syntax:
stringName.localeCompare(param1)
Parameters:
param1 Required; the string to search for inside the object.