如何在Objective-C中连接两个数字
发布时间:2020-12-14 17:18:03 所属栏目:百科 来源:网络整理
导读:如何连接两个数字,如7和6,得到数字76,或3和3,所以结果是33,在 objective-c? 解决方法 没有内置符号来连接数字.但是,您可以通过以下方式完成此操作: int first; /* Assuming this is initialized to the first number */int second; /* Assuming this is in
如何连接两个数字,如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]; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |