views:

46

answers:

0

I have tried both, separately

[formatter setMinusSign:@"?"];

The first one does not change the minus sign at all in my string. Doesn't have any visible effect. If I have a negative value, I see something like -321,65. But not ?321,65 for instance.

[formatter setNegativePrefix:@"?"];

Now, with that one I do get a ?321,65 for a float number of -321.65, so this one does have a visible effect, it does add that prefix for negative values. That's fine, but what bothers me about it is that there's another method -setMinusSign: which can be particularly dangerous. What if in some special case, i.E. some strange Locale of a country on another planet, has some special kind of minus sign and the NSNumberFormatter then does add that sign additionally to what I provided in -setNegativePrefix. Let's say that this sign indeed is a minus "-", and I also told to add a minus Prefix. Would it then be possible that I get a ugly output like "--321,65"?

Is it safe to assign an empty string to that minusSign property? Or what else is the point of these?