rfa*_*ias 5 ios firebase swift google-cloud-firestore
我的 Firestore 数据库包含带有重音字符的单词,例如尖锐符号 (\xc3\xa9)、波形符 (\xc3\xb1)、变音符号 (\xc3\xbc) 和变音符 (\xc3\xa7)。
\n\n我已经创建了一个自定义索引来按此字段排序,但带有此类字符的单词位置不正确。
\n\n预期订单示例:
\n\n[“\xc3\x81gua”,“阿米戈”,“巴罗”,“卡萨”]
\n\n我从 Firestore 得到的信息:
\n\n[“阿米戈”,“巴罗”,“卡萨”,“\xc3\x81gua” ]
\n\n我的查询是这样的:
\n\nlet query = historyRef.whereField("createdByUserID", isEqualTo: state.loggedUser.uid).order(by: "itemName", descending: false)\nRun Code Online (Sandbox Code Playgroud)\n\n有关如何修复它的任何指示吗?
\n\n提前致谢。
\n您可以像这样订购数组集合:
\n\nvar array = ["Amigo", "Barro", "Casa", "\xc3\x81gua"]\n\narray = array.sorted(by: {\n $0.lowercased().folding(options: .diacriticInsensitive, locale: .current)\n <\n $1.lowercased().folding(options: .diacriticInsensitive, locale: .current)\n})\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
2166 次 |
| 最近记录: |