gpt4 book ai didi

iphone - 如何增加 Objective-C 字符串中存储的数值

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

如何增加数字字符串值?

如果它最初是“1”,我想在每次 applicationDidEnterBackground 点击时增加它

最佳答案

就您而言,使用字符串来达到此目的很奇怪,但从技术上讲您可以这样做:

int myInt = [myString intValue];// I assume you need it as an integer.
myString= [NSString stringWithFormat:@"%d",++myInt];

关于iphone - 如何增加 Objective-C 字符串中存储的数值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9955604/

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