SoFunction
Updated on 2025-04-10

JS method to implement Chinese character sorting

This article describes the method of implementing Chinese character sorting by js. Share it for your reference. The details are as follows:

<script type="text/javascript">
<!--
  function startSort(){
   var a=('s').value;
   a=(',')
   ();
   ('r1').value=a;
   (function(a,b){return (b)});
   ('r2').value=a;
  }
//-->
</script>
<p>Array of strings containing Chinese characters(Use commas","Separate):<br />
<textarea  style="width: 100%; overflow: scroll; word-wrap: normal;" rows="10">Angela Chang,bearth,abort,Jacky Cheung,something,apple,Mayday,Andy Lau,banana,apple,Fan Weiqi,Asan</textarea></p>
<p style="text-align: center"><input type="button" value="Sorting Test" onclick="startSort()" style="width: 300px" /></p>
<p>Default sort results:<br />
<textarea  style="width: 100%; overflow: scroll; word-wrap: normal;" rows="10"></textarea></p>
<p>Chinese characters sorting results:<br />
<textarea  style="width: 100%; overflow: scroll; word-wrap: normal;" rows="10"></textarea></p>

I hope this article will be helpful to everyone's JavaScript programming.