MonoTouch 中缺少 NSDiacriticInsensitiveSearch 比较选项吗?
我想使用 iOS NSDiacriticInsensitiveSearch
比较选项来比较两个字符串,但我在 MonoTouch 库中找不到它。是不是不见了?
我可以使用任何 .NET 替代方案吗?
NSDiacriticInsensitiveSearch 比较选项对于在带有变音符号(如希腊语和斯堪的纳维亚语)的字母表上获得良好的搜索结果非常重要,而无需用户键入变音符号。
I want to compare two strings using the iOS NSDiacriticInsensitiveSearch
comparison option, but I cannot find it in the MonoTouch libray. Is it missing?
Is there any .NET alternative that I can use?
The NSDiacriticInsensitiveSearch comparison option is very importand to get good search results on alphabets with diacritics like Greek and Scandinavian, without having the user to type the diacritics.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
快速查看
NSDIacriticInsensitiveSearch
和NSStringCompareOptions
并没有显示它们在 MonoTouch 中可用。但是,您可以在 .NET 中进行文化感知字符串比较,但是我不知道在不考虑变音符号的情况下比较字符串的通用方法。最好的方法是在进行序数比较之前删除此类字符(请参阅博客条目)。
如果您要移植代码,或者确实需要
NSDiacriticInsensitiveSearch
支持,那么您可以在 http://bugzilla.xamarin.com,有人将在 MonoTouch 的未来版本中添加缺少的绑定。更新:MonoTouch 5.2 将支持
NSString.Compare
包括其选项,例如NSDiacriticInsensitiveSearch
。A quick look for
NSDiacriticInsensitiveSearch
andNSStringCompareOptions
do not show them as available in MonoTouch.However you have culture-aware string comparison available in .NET but I do not know of a general way to compare string without considering diacritic characters. The best approach would be to remove such characters before doing an ordinal comparison (see blog entry).
If you're porting code, or really needs
NSDiacriticInsensitiveSearch
support, then you can fill a bug report (Enhancement) at http://bugzilla.xamarin.com and someone will add the missing bindings in a future release of MonoTouch.UPDATE: MonoTouch 5.2 will support
NSString.Compare
including its options likeNSDiacriticInsensitiveSearch
.