如何在Objective-C中连接两个数字

前端之家收集整理的这篇文章主要介绍了如何在Objective-C中连接两个数字前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何连接两个数字,如7和6,得到数字76,或3和3,所以结果是33,在 objective-c

解决方法

没有内置符号来连接数字.但是,您可以通过以下方式完成此操作:

int first; /* Assuming this is initialized to the first number */
int second; /* Assuming this is initalized to the second number */
int myVal = [[NSString stringWithFormat:@"%d%d",first,second] intValue];

猜你在找的Xcode相关文章