Is NSNumberFormatter the only way to format an NSDecimalNumber?

后端 未结 4 1276
借酒劲吻你
借酒劲吻你 2020-12-31 11:20

I\'m using an NSDecimalNumber to store money in Core Data. I naively used stringWithFormat: at first to format the value, later realizing that it didn\'t support NSDecimalNu

4条回答
  •  有刺的猬
    2020-12-31 12:03

    Just convert it to a double and use "F"

    [NSString stringWithFormat:@"%1.2F", [ent doubleValue]];

提交回复
热议问题