gpt4 book ai didi

ios - 特殊 - 字符串中的汉字

转载 作者:可可西里 更新时间:2023-11-01 05:49:38 27 4
gpt4 key购买 nike

我正在用代码进行语言翻译。

self.title.text = [NSString stringWithFormat:NSLocalizedString(@"Q%ld", nil), (long)quizNumber];

我添加了本地化,这在法语中工作正常,但在中文中 '%ld' 出现在屏幕上。

如果我用中文字符串代替英文字符串,我会得到错误 “格式字符串未使用数据参数”

有什么指点吗?我应该使用某种编码吗?

最佳答案

我也在我的应用程序中用中文完成了本地化,到目前为止没有问题,但我主要使用 %d,而不是 %ld。

你能试试用 %d 代替吗?

self.title.text = [NSString stringWithFormat:NSLocalizedString(@"Q%d", nil), (int)quizNumber];

看看 https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html

关于ios - 特殊 - 字符串中的汉字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42577447/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com