Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Globalization;
- using System.Text;
- class CollationTest
- {
- class TestChar
- {
- public char Value { get; set; }
- public string Name { get; set; }
- public override string ToString()
- {
- return String.Format("{0} '{1}' ('\\u{2:X4}')", Name, Value, (int)Value);
- }
- }
- static void Main(string[] args)
- {
- string cultureName = args.Length >= 1 ? args[0] : "zh-Hans";
- var chars = new List<TestChar> {
- new TestChar { Value = '\u8303', Name = "fan" },
- new TestChar { Value = '\u5999', Name = "miào" },
- new TestChar { Value = '\u5DE7', Name = "qiǎo " },
- new TestChar { Value = '\u8EAB', Name = "shēn " },
- new TestChar { Value = '\u793A', Name = "shì " },
- new TestChar { Value = '\u4EE5', Name = "yǐ " },
- new TestChar { Value = '\u5219', Name = "zé " },
- new TestChar { Value = '\u4F5C', Name = "zuò " },
- };
- var cinfo = new CultureInfo(args[0]);
- Console.WriteLine("{0}: {1}", cinfo.Name, cinfo.DisplayName);
- chars.Sort((a,b)=>String.Compare(a.Value.ToString(),b.Value.ToString(),true,cinfo));
- foreach (var item in chars)
- {
- Console.WriteLine(item);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement