开发者

How do you replace period to comma without an error?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜