A number is a number is a number. Not a string. Not a representation of a number. But a number. There is no "+" character or "-" character stored with it. There are no commas, or periods, or other characters. It is a number. You can't have "plus symbol two apples"; you just have two apples.
The number 0.01 is positive. It is irrelevant where that number came from, or what the original string looked like that was used to produce the number.
If you wish to stringise a positive number with a leading +
, then that is about how you deal with the Number
object later when you later "convert" it back to a string. You can achieve that simply with an if
statement.
However to me your "desired outcome" looks like an object declaration, in which the presence or not of a leading +
would again be irrelevant, as you are storing a number. You can format it however you like at the receiving end of the data, if you need to present it to a human.