货币:字符串转换成货币格式
NSMutableString *newStr = [[NSMutableString alloc] initWithString:[NSString stringWithFormat:@"%ld",(long)_flowerNum]];
NSInteger insertPosition = newStr.length / 3;
NSInteger remaiderNum = newStr.length % 3;
NSInteger strLength = newStr.length;
if (strLength > 3) {
if (remaiderNum != 0) {
for (NSInteger i = 1; i <= insertPosition; i++) {
[newStr insertString:@"," atIndex:strLength - 3 * i];
}
}else{
for (NSInteger i = 1; i < insertPosition; i++) {
[newStr insertString:@"," atIndex:strLength - 3 * i];
}
}
}
浩/grand(博客作者)
著作权归作者所有,转载请联系作者获得授权,并标注“博客作者”。
著作权归作者所有,转载请联系作者获得授权,并标注“博客作者”。