A DESCRIPTION OF THE REQUEST :
The NumberFormat class is a nice class and has many great methods, but one thing that has always been troublesome is that fact that you can never enter a number format that has a leading space. You can do this with 0's but that is it. The "###" format will trim excess spaces and cause the whole idea behind the formatting to unravel.
JUSTIFICATION :
I have been in situations numerous times where I need to format a number and ALSO format the space it takes up. For example on a Y-Axis of a graph or any other component that might be affect adversly if size was a variable thing in certain areas. If I had number rangin from 20-80 in one graph but 0-100 in another my graph changes size due to the NumberFormat no being consistent.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I think if you specify "###" there should always be 3 characters and this possibly could be defined by the user.
ACTUAL -
It trims off the spaces for instance if the above example would have been a 20 it will give you back "20" rather than " 20".
CUSTOMER SUBMITTED WORKAROUND :
Making a hack with the ChoiceFormat is one way. But that is a total hack.
###@###.### 11/2/04 21:22 GMT
The NumberFormat class is a nice class and has many great methods, but one thing that has always been troublesome is that fact that you can never enter a number format that has a leading space. You can do this with 0's but that is it. The "###" format will trim excess spaces and cause the whole idea behind the formatting to unravel.
JUSTIFICATION :
I have been in situations numerous times where I need to format a number and ALSO format the space it takes up. For example on a Y-Axis of a graph or any other component that might be affect adversly if size was a variable thing in certain areas. If I had number rangin from 20-80 in one graph but 0-100 in another my graph changes size due to the NumberFormat no being consistent.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I think if you specify "###" there should always be 3 characters and this possibly could be defined by the user.
ACTUAL -
It trims off the spaces for instance if the above example would have been a 20 it will give you back "20" rather than " 20".
CUSTOMER SUBMITTED WORKAROUND :
Making a hack with the ChoiceFormat is one way. But that is a total hack.
###@###.### 11/2/04 21:22 GMT
- duplicates
-
JDK-4191595 [Fmt-Nu] RFE: Add symbol to DecimalFormat that puts a space when there is no digit
-
- Closed
-