tags:

views:

72

answers:

1

The NSNumberFormatter class has plusSign and minusSign properties, but also has positivePrefix and negativePrefix.

What is the difference between these two? If I specify both, which one comes first?

+2  A: 

plusSign and minusSign are used for the mathematical addition and subtraction operators. positivePrefix and suffix and negativePrefix and suffix are used to describe what characters/strings are used todisplay whether a certain numeric value is positive or negative.

To illustrate why they are different: most of the times, when a positive numeric value is displayed anywhere you'll just see numbers, No prefix or suffix. Negative numeric values have a minus in front, or behind them, or, in some styles of accounting they're just enclosed in brackets. Either way we'll still need a + and a - to express mathematical operations.

Dirk Stoop
Good answer-- Thanks!
Adam Ernst