开发者

Adding to a NSString

How can I create 开发者_如何转开发a string that can have integers added and removed to it with a simple + or -1?


You can't. What you can do is add or subtract from a number and get the string representation when you need it:

int a = 30;
a++;
a--; // etc.
NSString *numberString = [NSString stringWithFormat:@"%d", a];

If you want to append or remove characters representing integers from the end of strings, look into the NSString class.

If you're looking for operator overloading, Objective C doesn't have it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜