Js Chinese Character sorting problems support Chinese and English hybrid sorting, compatible with various browsers, including CHROME

Source: Internet
Author: User

Specific Technology 1. Use GB encoding and UNICODE Conversion
2. array Association sorting
Note: GB encoding library address http://demo.jb51.net/jslib/qswhGB2312.js
Code (the demo is very simple)
Copy codeThe Code is as follows:
<Script>
// Power by plush cat liuyutong@baidu.com
Var strGB = "ah, sorry, no cancer, no. I love the saddle, no ammonia, and the case of the dark shore amine. ba ba Bai banban move pull like board Board dress mix with flap half run bang bang bao report violent benbenbenbenbenbenbenbenbenbenbenbenbenbenwealitao yundun bian bian will change to Bian Biao Yu table Yu Bian Bin bing bo platinum foil bo barge bu Wei cangzang operation rough groove Cao grass toilet policy side volume test layer rub inserted cross cutting tea cha difference split Chai Yi mixed with Chan yi wrapped around shovel production explanation trembling Chang Yi changchang changchangchangchangchangchangchangchangsong advocates ultra-copy of banknotes to laugh at the tide of the nest, quarrel, stir-fry the car, pull away from Chen Shen chen yu lining support called city orange cheng cheng xian look Ugly smelly Chu Chuan Chuang blow Yan hammer spring Chun alcohol lips chunchun dumb poke Z magnetic female ci CI Cong Shilin Ling from the cluster together coarse vinegar cluster to promote Yi Jin Cui urge brittle Yi Jing quenching Cui Cun learn how to get rid of these mistakes and try to answer the question. You can wear a bag with a loan representative to be caught. dang Dao prayer directed to Dao Yu Dao De de di di di Dian Yao tang Ding ding order to lose Dong understands Dong Han frozen cave pocket shake Doudou steep bean tease pox du Duan cut satin Heping the team squatted to dunton, dunton, blunt shield, Duo Xiao Yi yi er bait second issue penalty raft cutting missing valve method Fan fei Feiyu bark lung waste boiling Fen FENG Yu Feng Fu Fufu fu attached to the women bind lingga the change of calcium cover dry Gan Gang gang Gao Mo Bing cake to pick up the draft Ge gonggong common hook groove dog scale structure purchase enough tolerance Gu hired to scrape guua Gu guan Guang GUI Guo wrapped through ha Xi child sea han hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha the Yellow River, the Yellow River, the brown, the Hehe, and the black marks are very hateful. Heng, Hong, Hong, Hou hou, Hou hou, then Hu HU Hu paste Lake arc Hu HU huhua Hua Yi slippery painting cut words Huai bad Huan HUan Huang panying Huang Sulu yi spring Huang Yu lie gray hui yi Yin Wu fire get or confuse Huo's curse attack Ji ji Jia pod cheek Jia K fake price frame drive marry Jian jian Jiang Jian jiang propeller award Jiang Jiao Zheng Jiao Yu jie Jin ban Jin jie jing click JU Xi Yu dig Jue Jun ka Kai kai Kan kan Kang Yi Kang Yu test copy roast rely on ke Chen ke quick wide Kuang basket crazy frame mine eye condition loss helmet glimpse Kui Wei kukun bundle sleepy expanded wide pull la wax La la Lai LAN lan LAN Lang ling Leng Li Lian He lian Liang Xiao Xi Wei Liao He Li lie inferior Lin phosphorus Linlin Adjacent Scales linning Ling ridge collection Lou Lu rate Filtering: luolun, lunlun, lunlun, luoluo, ma, Mao, and so on. buy Mai Yu Han man Mao Mei enzyme moldy Coal mei men Meng Mn Meng Miao ether Mi Mian Miao momomo Momo moo moji mo moumou Mu Na na ne Nai milk Nai Nan capsule scratching the brain annoying inside neni nianyi nianni intends you to get tired of moling Niang nig Niu nizun niyun niunning Niang Niu twist nuo crawling panpan Pani the bank determined the rebellion, the pang side, the fat throw, the plane, the gun robe, the run, the bubble, the embryo, the Pei, the spray basin, the bang, the peng batch of peat pi pig piping ping po po pu qi Qian an unapologized gun is embedded in the shell, and the wall is forced to grab a slide, and the shovel is knocked on. Qiao's clever sheath is tilted, Qiao is cut into the eggplant, And the hacker steals the Qin and the birds go to bed qing Qiu Zheng qu Yu qu go round Quan Aldehyde quan throwing sun Rong RuO soft meat Ru RuO soft Shen three umbrella sansang swordsmanifest scan sizing Sensa sand killing Sha yarn What sha screen Sun Shan Delete Shan injury commodity rewards Shang Xiao Shen Xiao Shao Xiao shen Sheng Shi Xi Shi shi shu Xi Shuai Shushu Shu Shuang who water sleep tax suck instant shun said Shuo si although Su Sui Su tai Dai pattern Tai Tong Tan Tang escape taotao to discuss the set of special Teng pain ladder pick up and kick antimony question shoot body for Xiao shaving Tiantian fill Tian Yi pick up a piece of yellow jump tietie Hall listen to INS ting boat Tong bucket Tong tu Wu Tutu tuu leg yi fade back tuo Wa Po Wan wang Zhongwei Wangwang Weiwei Wei wen Yu Wu wu Xi se Si Xi xianxiao Xixia Xia Xian xiang Xiao xie Jie salary core zinc xin Xin Xing chest Hungary Xiong Xiu Shu Xi XU Xu Xuan xuxuan boots Xue Xun ya Yan yan Yang yang itch sample Yang invitation Yao yi yi Yin Ying yong Yu yu yuan Yue yuan zai again in my temporarily likes dirty buried by the bad cut algae jujube early bath flea noisy make soap stove dry responsibility selection then ze thieves How to increase the amount of money has given the slag Zha Rolling the gate blinks, the gate is squeezed, and at first glance it's a scam to pick the Zhai's narrow debt village Zhan felt Zhan Zhang zhangzhang zhangzhangzhangzhangzhangzhangzhangzhangzhangzhangzhangzhangzhang account account battle expansion and obstacle Zhao mask Zhao cover Zhe zhe ge cane this Zhe Zhen needle detection pillow rash diagnosis Zhen zhengzheng Zhizhi zhijiao Zhizhi Zhike Zhizhi zhijiao Zhizhi zhishou Zhizhi the purpose of the paper Zhizhi throw to the Zhizhi rank Zhizhi zhongzhong Zhongzhou Zhouzhou porridge axis elbow curse wrinkle zhou Xi sudden beaded spider Zhu pig Zhu Zhe makeup hitting the zhuanglike vertebral cone chasing actor pendant repair quasi catch Zhuo table Zhuo Zi zong please refer to the following: there is no such thing zookeeper and zookeeper there are two major challenges: there are two different types of images. i'm a senior hacker, and I'm a senior hacker. there are two major problems in the future. please refer to the following: there are two major problems: chicory, pear, and pear. please refer to the following link for more information: repair of zookeeper olicranium tainii orniae taobaodi taobaoshi zookeeper zookeeper in addition I have been talking about it, and I have been talking about it. I am sorry for this. zookeeper nizyl oxazole and zookeeper metricoline zookeeper hey, hey, you know oh, I'm sorry, I'm sorry. zookeeper zookeeper when the peak was reached, it was as if it had been followed by a number of migration attacks. there are two possible reasons for this problem: please refer to the following documents for more information: there are two major challenges: stunned by the fact that there is no such thing as too many threads and threads in the system. there are two major problems: I have been very careful about the problem. indulge in zookeeper bromide zookeeper there are two major problems: there are two major problems in the future. I am sorry for the problem. these two problems have been solved. the number of zookeeper in the United States is different from that in the United States. when it comes to large numbers of users, there will be huge numbers of users. zookeeper and zookeeper zookeeper and zookeeper zookeeper and zookeeper OF THE UNITED STATES neighborhood niighborhood taobaoer taobaoyu the yundun zookeeper and zookeeper in the past, we have been looking forward to seeing you again and again. zookeeper zookeeper injection of uranium chloride, argon, argon, and zookeeper when the system was deployed, the zookeeper and zookeeper were successfully added to the zookeeper, the zookeeper, and zookeeper. zookeeper zookeeper simhei Yi Wei stew taobaoyu Xuan yi Yu Lu Yi yi xu Xi Yu Qu Yu even though we have been talking about it, we have been talking about it. zookeeper is an extremely large number of visitors. zookeeper Ru and thomonium L. Tungsten tungsten titanium tungsten tunnel Tunnel %%^%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% zookeeper zookeeper cadmium was recognized as zookeeper. zookeeper zookeeper yardium yundun please refer to the following link for more information: the primary there are two major risks: very cute, very cute, very cute, and very cute. coupled with zookeeper, Zookeeper, and zookeeper. zookeeper yundun zookeeper rankus zookeeper and zookeeper there will be a huge number of Chinese Zheng zookeeper and zookeeper of the Communist Party of China hybriddb for MySQL and hybriddb for MySQL. zookeeper zookeeper fermented soy sauce and maleic anhydride zookeeper oxyl ester zookeeper fermented grains zookeeper I was very drunk, and I was very confused. during the process, you can see the results of these attacks. wen Wenyu was a hacker, and a hacker. crocodile catfish bread catfish zookeeper there are two major causes for this problem: shi lindai was deprecated, and he was a hacker ";
Var qswhSpell = ["a", 0, "ai", 2, "an", 15, "ang", 24, "ao", 27, "ba", 36, "bai", 54, "ban", 62, "bang", 77, "bao", 89, "bei", 106, "ben", 121, "beng ", 125, "bi", 131, "bian", 155, "biao", 167, "bie", 171, "bin", 175, "bing", 181, "bo", 190, "bu", 211, "ca", 220, "cai", 221, "can", 232, "cang", 239, "cao ", 244, "ce", 249, "ceng", 254, "cha", 256, "chai", 267, "chan", 270, "chang", 280, "chao", 293, "che", 302, "chen", 308, "cheng", 318, "chi", 333, "chong", 349, "chou ", 354, "chu", 366, "chuai", 382, "chuan", 383, "chuang", 390, "chui", 396, "chun", 401, "chuo", 408, "ci", 410, "cong", 422, "cou", 428, "cu", 429, "cuan", 433, "cui ", 436, "cun", 444, "cuo", 447, "da", 453, "dai", 459, "dan", 471, "dang", 486, "dao", 491, "de", 503, "deng", 506, "di", 513, "dian", 532, "diao", 548, "die ", 557, "ding", 564, "diu", 573, "dong", 574, "dou", 584, "du", 591, "duan", 606, "dui", 612, "dun", 616, "duo", 625, "e", 637, "en", 650, "er", 651, "fa ", 659, "fan", 667, "fang", 684, "fei", 695, "fen", 707, "feng", 722, "fo", 737, "fou", 738, "fu", 739, "ga", 784, "gai", 786, "gan", 792, "gang", 803, "gao ", 812, "ge", 822, "gei", 839, "gen", 840, "geng", 842, "gong", 849, "gou", 864, "gu", 873, "gua", 891, "guai", 897, "guan", 900, "guang", 911, "gui", 914, "gun ", 930, "guo", 933, "ha", 939, "hai", 940, "han", 947, "hang", 966, "hao", 969, "he", 978, "hei", 996, "medium", 998, "heng", 1002, "hong", 1007, "hou", 1016, "hu ", 1023, "hua", 1041, "huai", 1050, "huan", 1055, "huang", 1069, "hui", 1083, "hun", 1104, "huo", 1110, "ji", 1120, "jia", 1173, "jian", 1190, "jiang", 1230, "jiao", 1243, "jie ", 1271, "jin", 1298, "jing", 1318, "jiong", 1343, "jiu", 1345, "ju", 1362, "juan", 1387, "jue", 1394, "jun", 1404, "ka", 1415, "kai", 1419, "kan", 1424, "kang", 1430, "kao ", 1437, "ke", 1441, "ken", 1456, "keng", 1460, "kong", 1462, "kou", 1466, "ku", 1470, "kua", 1477, "kuai", 1482, "kuan", 1486, "kuang", 1488, "kui", 1496, "kun", 1507, "kuo ", 1511, "la", 1515, "lai", 1522, "lan", 1525, "lang", 1540, "lao", 1547, "le", 1556, "lei", 1558, "leng", 1569, "li", 1572, "lia", 1606, "lian", 1607, "liang", 1621, "liao ", 1632, "lie", 1645, "lin", 1650, "ling", 1662, "liu", 1676, "long", 1687, "lou", 1696, "lu", 1702, "lv", 1722, "luan", 1736, "lue", 1742, "lun", 1744, "luo", 1751, "ma ", 1763, "mai", 1772, "man", 1778, "mang", 1787, "mao", 1793, "me", 1805, "mei", 1806, "men", 1822, "meng", 1825, "mi", 1833, "mian", 1847, "miao", 1856, "mie", 1864, "min ", 1866, "ming", 1872, "miu", 1878, "mo", 1879, "mou", 1896, "mu", 1899, "na", 1914, "nai", 1921, "nan", 1926, "nang", 1929, "nao", 1930, "ne", 1935, "nei", 1936, "nen ", 1938, "neng", 1939, "ni", 1940, "nian", 1951, "niang", 1958, "niao", 1960, "nie", 1962, "nin", 1969, "ning", 1970, "niu", 1976, "nong", 1980, "nu", 1984, "nv", 1987, "nuan ", 1988, "nue", 1989, "nuo", 1991, "o", 1995, "ou", 1996, "pa", 2003, "pai", 2009, "pan", 2015, "pang", 2023, "pao", 2028, "pei", 2035, "pen", 2044, "peng", 2046, "pi ", 2060, "pian", 2077, "piao", 2081, "pie", 2085, "pin", 2087, "ping", 2092, "po", 2101, "pu", 2110, "qi", 2125, "qia", 2161, "qian", 2164, "qiang", 2186, "qiao", 2194, "qie ", 2209, "qin", 2214, "qing", 2225, "qiong", 2238, "qiu", 2240, "qu", 2248, "quan", 2261, "que", 2272, "qun", 2280, "ran", 2282, "rang", 2286, "rao", 2291, "re", 2294, "ren ", 2296, "reng", 2306, "ri", 2308, "rong", 2309, "rou", 2319, "ru", 2322, "ruan", 2332, "rui", 2334, "run", 2337, "ruo", 2339, "sa", 2341, "sai", 2344, "san", 2348, "sang ", 2352, "sao", 2355, "se", 2359, "sen", 2362, "seng", 2363, "sha", 2364, "shai", 2373, "shan", 2375, "shang", 2391, "shao", 2399, "she", 2410, "shen", 2422, "sheng", 2438, "shi ", 2449, "shou", 2496, "shu", 2506, "shua", 2539, "shuai", 2541, "shuan", 2545, "shuang", 2547, "shui", 2550, "shun", 2554, "shuo", 2558, "si", 2562, "song", 2578, "sou", 2586, "su ", 2589, "suan", 2602, "sui", 2605, "sun", 2616, "suo", 2619, "ta", 2627, "tai", 2636, "tan", 2645, "tang", 2663, "tao", 2676, "te", 2687, "teng", 2688, "ti", 2692, "tian ", 2707, "tiao", 2715, "tie", 2720, "ting", 2723, "tong", 2733, "tou", 2746, "tu", 2750, "tuan", 2761, "tui", 2763, "tun", 2769, "tuo", 2772, "wa", 2783, "wai", 2790, "wan ", 2792, "wang", 2809, "wei", 2819, "wen", 2852, "weng", 2862, "wo", 2865, "wu", 2874, "xi", 2903, "xia", 2938, "xian", 2951, "xiang", 2977, "xiao", 2997, "xie", 3015, "xin ", 3036, "xing", 3046, "xiong", 3061, "xiu", 3068, "xu", 3077, "xuan", 3096, "xue", 3106, "xun", 3112, "ya", 3126, "yan", 3142, "yang", 3175, "yao", 3192, "ye", 3207, "yi ", 3222, "yin", 3275, "ying", 3291, "yo", 3309, "yong", 3310, "you", 3325, "yu", 3346, "yuan", 3390, "yue", 3410, "yun", 3420, "za", 3432, "zai", 3435, "zan", 3442, "zang ", 3446, "zao", 3449, "ze", 3463, "zei", 3467, "zen", 3468, "zeng", 3469, "zha", 3473, "zhai", 3487, "zhan", 3493, "zhang", 3510, "zhao", 3525, "zhe", 3535, "zhen", 3 545, "zheng", 3561, "zhi", 3576, "zhong", 3619, "zhou", 3630, "zhu", 3644, "zhua", 3670, "zhuai ", 3672, "zhuan", 3673, "zhuang", 3679, "zhui", 3686, "zhun", 3692, "zhuo", 3694, "zi", 3705, "zong", 3720, "zou", 3727, "zu", 3731, "zuan", 3739, "zui", 3741, "zun", 3745, "zuo ", 3747];
Var length = qswhSpell. length;
Function getSpell (str ){
Var I, c, t, ret = "";
Var strLength = str. length
For (I = 0; I <strLength; I ++ ){
If (str. charCodeAt (I)> = 0x4e00 ){
C = strGB. indexOf (str. charAt (I ));
If (c>-1 & <c 3755 ){
For (t = length-1; t> 0; t = t-2 ){
If (qswhSpell [t] <= c ){
Break;
}
}
If (t> 0 ){
Ret + = qswhSpell [T-1];
}
}
} Else {
Ret + = str. slice (I, I + 1 );
}
Return ret. substr (0, ret. length. length );
}
Var arr = ['aston ', 'login',' Ah, It's V', 'sasa Master', 'odesa', 'adsa ']
Var arr_t = [];
For (I = 0; I <arr. length; I ++ ){
Arr_t [I] = [getSpell (arr [I]), arr [I];
}
Arr_t = arr_t.sort ();
For (I = 0; I <arr. length; I ++ ){
Arr [I] = arr_t [I] [1];
}
Alert (arr)
</Script>

Note: This sorting mechanism is compatible with IE and ff to achieve unified sorting in all browsers ~
The most valuable is ~ This Code sets the effect of English and Chinese Character mixing ~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.