gpt4 book ai didi

NSString stringWithFormat 百分号

转载 作者:行者123 更新时间:2023-12-04 01:31:08 29 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





How to add percent sign to NSString

(7 个回答)


6年前关闭。




我搜索并找不到这个答案......

如果我有这个,我怎样才能让它显示最终的 % 符号?它只是在我的标签中省略了它。

[NSString stringWithFormat:@"Tries %i%", tries];

最佳答案

我想我可以贡献一点并分享 this comprehensive list 选项。杰西是
对!

就我而言,以下方法可以解决问题!

[NSString stringWithFormat:@"Progress: %.2f%%", progress*100] 
// progress is float ranging 0.0-1.0,
//and I would like it to print up to 2 decimal point

快乐编码!

关于NSString stringWithFormat 百分号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8043164/

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