gpt4 book ai didi

iphone - 在输出中使用 '%'

转载 作者:行者123 更新时间:2023-12-03 20:28:59 25 4
gpt4 key购买 nike

可能是一个非常简单的问题,我一直在寻找答案但找不到它,可能是因为我还没有找到要问什么。

我想要以下输出,请参阅输出中的“%”字符:

(33%)

我只是不明白如何格式化“%”字符,以便在输出中看到它。

txt2 = [txt2 stringByAppendingFormat:@"(%i)", percentage];

我知道上面的 stringByAppendingFormat 是错误的。我将非常感谢任何帮助。

最佳答案

用另一个 % 转义它,这样你会得到这样的结果:

txt2 = [txt2 stringByAppendingFormat:@"(%i%%)", percentage];

有关与格式化函数一起使用的所有格式说明符的列表,请参阅 here .

关于iphone - 在输出中使用 '%',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4639699/

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