我想弄清楚如何在 iOS 上获取两位数的 NSInteger(例如 11)并将其转换为 2 个独立的 NSInteger,每个看起来都像“1”。在 NSInteger 中它总是只有 2 位数字,不多不少,也没有小数。
最佳答案
您可以简单地使用整数/模运算
int tensDigit=originalNumber / 10;
int onesDigit=originalNumber % 10;
关于ios - 将两位数的 NSInteger 拆分为两个 NSInteger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30993847/