Converting NSDecimalNumber to NSString

后端 未结 5 1779
伪装坚强ぢ
伪装坚强ぢ 2021-02-02 15:06

I\'m retrieving a key from an object that looks like this:

po obj
{
  TypeID = 3;
  TypeName = Asset;
}

The key value is being retrieved like t

5条回答
  •  天命终不由人
    2021-02-02 15:46

    Since this is the top search result and I don't see a question for NSDecimalNumber to String in Swift, here it is. This will show the localized decimal separator and all decimal places with a non-zero value.

    let string = decimalNumber.description(withLocale: Locale.current)

提交回复
热议问题