作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
是否可以按片假名对日语字符串列表进行排序?
最佳答案
当然可以。如果您使用 CultureInfo,您可以将其设置为无需查找大写/小写字母。
// Create CultureInfo
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("ja-JP");
//Create the StringComparer
StringComparer cmp = StringComparer.Create(ci, true);
// Sort your array of string
Array.Sort(myArray, cmp);
如果您愿意,您可以扩展排序的功能以不区分平假名和片假名:
//Create CultureInfo
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("ja-JP");
// Set it so it ignores the kana type
CultureInfoCompare cmp =
new CultureInfoCompare(ci, System.Globalization.CompareOptions.IgnoreKanaType);
//Sort it
Array.Sort(myArray, cmp);
頑張っテください!
关于c# - 在 C# 中按片假名对日语文本进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6900061/
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎偏离主题,因为它缺乏足够的信息来诊断问题。 更详细地描述您的问题或 include a mini
我想使用正则表达式从字符串中仅提取字母。这些字母可以来自任何类型的字母表。 我想获取文本并删除所有非字母的符号(保留空格)。我厌倦了使用正则表达式删除一组符号,但添加一路上发现的所有新类型符号的效率非
我熟悉不同的 MySQL 排序规则,我的数据库当前设置为 UTF8_general_ci,并且我使用 UTF8_unicode_ci 进行了半成功的搜索。我正在运行 mysql 5.6,我无法使用最新
我是一名优秀的程序员,十分优秀!