【发布时间】:2020-05-01 09:04:18
【问题描述】:
我为我的问题寻找解决方案。如果我在 localizable.string 中有一个字符串,例如:
"stringExample" = "My name is ";
如何正确添加名称?
我不想做string = string + "userName"
有什么办法吗?
【问题讨论】:
我为我的问题寻找解决方案。如果我在 localizable.string 中有一个字符串,例如:
"stringExample" = "My name is ";
如何正确添加名称?
我不想做string = string + "userName"
有什么办法吗?
【问题讨论】:
您可以使用"stringExample = "My name is %@";,并使用本地化字符串作为字符串格式:
let fmt = NSLocalizedString("stringExample", "")
let myNameIs = String(format: fmt, "Max")
【讨论】: