美文网首页
Swift 的汉字排序 — 拼音、注音、笔画

Swift 的汉字排序 — 拼音、注音、笔画

作者: 麦志超 | 来源:发表于2023-09-21 10:47 被阅读0次

拼音排序

let locale = Locale(identifier: "zh@collation=pinyin")

let pinyinSorted = nameList.sorted {
    $0.compare($1, locale: locale) == .orderedAscending
}

注音排序

let localeZhuyin = Locale(identifier: "zh@collation=zhuyin")

let zhuyinSorted = nameList.sorted {
    $0.compare($1, locale: localeZhuyin) == .orderedAscending
}

笔画排序

let localeStroke = Locale(identifier: "zh@collation=stroke")

let strokeSorted = nameList.sorted {
    $0.compare($1, locale: localeStroke) == .orderedAscending
}

相关文章

  • pythoin pypinyin汉字转拼音库使用

    pypinyin 将汉字转为拼音。可以用于汉字注音、排序、检索 。 Documentation: http://p...

  • 汉字转化为拼音--python实现

    将汉字转为拼音。可以用于汉字注音、排序、检索。GitHub地址:https://github.com/mozill...

  • Python汉字拼音转换工具

    将汉字转为拼音,可以用于批量汉字注音、文字排序、拼音检索文字等常见场景。现在互联网上有许多拼音转换工具,基于Pyt...

  • Python 中拼音库 PyPinyin 的使用

    ython 中提供了汉字转拼音的库,名字叫做 PyPinyin,可以用于汉字注音、排序、检索等等场合,是基于 ho...

  • Python 中拼音库 PyPinyin 的用法

    Python 中提供了汉字转拼音的库,名字叫做 PyPinyin,可以用于汉字注音、排序、检索等等场合,是基于 h...

  • pinyin 依赖包

    pinyin:转换中文字符为拼音。可以用于汉字注音、排序、检索。特性:根据词组智能匹配最正确的拼音。支持多音字。简...

  • 查找汉字偏旁部首的EXCEL模板

    老婆的课题研究中,需要将部分汉字按偏旁部首排序。我知道在Excel中,对汉字的排序可以按拼音,可以按笔画,但是没有...

  • 三年语文积累运用

    一、注音或写出汉字 粗心( ) 准备( ) 勇敢( ) 花瓣( ) 拼音( ...

  • Oracle基础学习

    oracle实现汉字按照拼音、笔画和部首排序Oracle9i之前,中文是按照二进制编码进行排序的。在oracle9...

  • 期末句型基础练习

    一、生字我会写,借助看拼音写汉字记牢,每个单元的看拼音写汉字。 二、我会认,借助卡片,识字袋,注音反复读。 三、我...

网友评论

      本文标题:Swift 的汉字排序 — 拼音、注音、笔画

      本文链接:https://www.haomeiwen.com/subject/vbqzvdtx.html