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.
精彩评论