Converting NSDecimalNumber to NSString

后端 未结 5 1573
伪装坚强ぢ
伪装坚强ぢ 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:25

    Use this to convert NSDecimalNumber to NSString:

    NSDecimalNumber* dec1;
    NSString* str;
    
    str = dec1.stringValue;
    

    Use this to convert NSString to NSDecimalNumber:

    NSString* string1 = @"Stack overflow 123";
    NSDecimalNumber* dec;
    
    dec = (NSDecimalNumber *)string1;
    

提交回复
热议问题