JavaScript 字符串localeCompare方法(函数)


JavaScript 字符串localeCompare方法(函数)

<html>
   <head>
      <title>JavaScript String localeCompare() Method</title>
   </head>

   <body>

      <script type = "text/javascript">
         var str1 = new String( "This is beautiful string" );
         var index = str1.localeCompare( "XYZ" );
         document.write("localeCompare first :" + index );

         document.write("<br />" );

         var index = str1.localeCompare( "AbCD ?" );
         document.write("localeCompare second :" + index );
      </script>

   </body>
</html>