java - How to parse BigDecimal into Text with EU decimal separator but no decimal numbers at the end? -


I should be able to parse a "1.000," string in BigDiskim 1000 and then parse the same BigDisk in "1.000", string.

Why do both do the same exact DecimalFormat formation? Because I need to compare at the end of each stage that the two strings are identical, i.e. whether the parsing is correct or not.

So far, I tried to use these two samples: DecimalFormat ("###. ## 0,") and decimal ("0," ) but they do not produce the exact "1.000" at the end.

This is my code:

  list & lt; Number format & gt; Format = New Arreelist & lt; Number format & gt; (); Formats.add (DecimalFormat (". ### ## 0,")); Formats.add (DecimalFormat ('0')); (Number format format: format) for {number number = format. Text (text); Format.setParseIntegerOnly (incorrect); If (number! = Null & format (format, number). Par (text)) {back true; }}    

I have actually figured out this. I had to define the form of pattern

decimal ("###, ## 0", new decimal phrase (Locale))

And

decimal ("0", the new decimal formulations (locale))

and I had to add it to the number formatted object: < Ex> format.setParseInteger only (incorrect);

To make it work for the EU number.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -