开发者

How do you replace period to comma without an error?

开发者 https://www.devze.com 2023-02-16 08:50 出处:网络
I am newbie. I want to get rid of period. 开发者_JS百科How do I fix this without googling, hair pulling, and errors.

I am newbie. I want to get rid of period. 开发者_JS百科How do I fix this without googling, hair pulling, and errors.

float string = [@"145,000" doubleValue] * [@".0022" doubleValue];

NSNumber *num=[NSDecimalNumber decimalNumberWithString:string ];

Money.text = [ NSString stringWithFormat:@"$ %.3f",num ];


You can work around your issue by using this way:

[@"145,000" setString: [@"145,000"stringByReplacingOccurrencesOfString:@"," withString:@"."]];

or Vis Versa use it according to your need.

0

精彩评论

暂无评论...
验证码 换一张
取 消