zoukankan      html  css  js  c++  java
  • 汉字按笔画数排序

     string[] arr = { "地", "王一", "二", "大", "水", "国", "观","王二" };
     CultureInfo StrokCi = new CultureInfo(133124);
     Thread.CurrentThread.CurrentCulture = StrokCi;
     Array.Sort(arr);   //按笔画数排序

     Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-cn");
     Array.Sort(arr);   //按拼音排序

    参考:http://www.cnblogs.com/zfanlong1314/p/4550070.html

    class Program
        {
            static void Main(string[] args)
            {
                string[] arr = { "趙(ZHAO)", "錢(QIAN)", "孫(SUN)", "李(LI)", "周(ZHOU)", "吳(WU)", "鄭(ZHENG)", "王(WANG)"};

                //发音 LCID:0x00000804
                CultureInfo PronoCi = new CultureInfo(2052);
                //Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us");
                Array.Sort(arr);
                Console.WriteLine("按发音排序:");
                for (int i = arr.GetLowerBound(0); i <= arr.GetUpperBound(0); i++)
                    Console.WriteLine("[{0}]: {1}", i, arr.GetValue(i));

                Console.WriteLine();

                //笔画数 LCID:0x00020804
                CultureInfo StrokCi = new CultureInfo(133124);
                Thread.CurrentThread.CurrentCulture = StrokCi;
                Array.Sort(arr);
                Console.WriteLine("按笔划数排序:");
                for (int i = arr.GetLowerBound(0); i <= arr.GetUpperBound(0); i++)
                    Console.WriteLine("[{0}]: {1}", i, arr.GetValue(i));

                Console.WriteLine();

                //zh-cn (拼音:简中)
                Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-cn");
                Array.Sort(arr);
                Console.WriteLine("zh-cn:");
                for (int i = arr.GetLowerBound(0); i <= arr.GetUpperBound(0); i++)
                    Console.WriteLine("[{0}]: {1}", i, arr.GetValue(i));

                Console.WriteLine();

                //zh-tw (笔划数:繁中)
                Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-tw");
                Array.Sort(arr);
                Console.WriteLine("zh-tw:");
                for (int i = arr.GetLowerBound(0); i <= arr.GetUpperBound(0); i++)
                    Console.WriteLine("[{0}]: {1}", i, arr.GetValue(i));

                Console.ReadKey();

            }
        }

  • 相关阅读:
    [CocosCreator]-12-音频播放
    [CocosCreator]-11-文本输入-EditBox 组件
    [CocosCreator]-10-Button(按钮)
    深入理解正则表达式高级教程
    正则表达式匹配次数
    如何理解正则表达式匹配过程
    正则表达式工具RegexBuddy使用教程
    正则表达式批量替换通过$
    正则前面的 (?i) (?s) (?m) (?is) (?im)
    Net操作Excel_NPOI
  • 原文地址:https://www.cnblogs.com/81/p/9794635.html
Copyright © 2011-2022 走看看