簡體   English   中英

特殊 - 字符串中的漢字

[英]Special - Chinese characters in string

我在代碼中進行語言翻譯。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM