NSString isEqualToString:不等于韩语。

发布于 2024-12-22 03:38:24 字数 270 浏览 5 评论 0原文

开发基于 iOS5 的 cocoa 应用程序,如果本地化是英语,下面的比较工作正常,但如果本地化是韩语,则失败。

 //title is of type NSString

 if([title isEqualToString:NSLocalizedString(@"Power",@"Power")])

韩语标题和本地化字符串明显相同。

isEqualToString: 与韩语/unicode 字符串不匹配吗?

Developing iOS5 based cocoa app, below peice of comparison works fine if localization is English, but fails if localization is Korean.

 //title is of type NSString

 if([title isEqualToString:NSLocalizedString(@"Power",@"Power")])

in korean title and localized string is same visibly.

does isEqualToString: doesnot match Korean/unicode strings?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

明月松间行 2024-12-29 03:38:24

只是一个猜测。

我认为它在英语中不起作用,但由于您在 NSLocalizedString() 中使用英语单词,因此应用程序默认使用它们,这就是让您认为它有效的原因。
问题应该出在其他地方。

检查 : 是否

          NSLog(@"localized power = %@",NSLocalizedString(@"Power",@"Power"));

返回韩语翻译。

Just a guess.

I assume that it does not work in English to, but since you are using the english words in your NSLocalizedString() the app uses them is default and that's what make you think it works.
The problem should be elsewhere.

Check if :

          NSLog(@"localized power = %@",NSLocalizedString(@"Power",@"Power"));

returns the korean translation.

猫七 2024-12-29 03:38:24

使用 NSString 的本地化比较方法可能会获得更好的结果:-localizedCaseInsensitiveCompare:-localizedCompare:-localizedStandardCompare:

You might get better results using NSString's localized comparison methods: -localizedCaseInsensitiveCompare:, -localizedCompare:, or -localizedStandardCompare:.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文