Results 1 to 5 of 5
- 06-06-2012, 02:07 PM #1
Member
- Join Date
- Jun 2012
- Posts
- 2
- Rep Power
- 0
DecimalFormat fromat method return junk chacter , formate with this value "NaN"
Hello all
I get the following issue when i use the DecimalFormat java class for format the value in java program,
Below is my the java code
String pattern = "0";
String value[] = new String[1];
value[0] = "NaN";
DecimalFormat myFormatter = new DecimalFormat(pattern);
value[0] = myFormatter.format(Double.parseDouble(value[0]));
Here when my java consol can not print the value[0] , When i had debug it and check its value is display as small square in debug console
while in html page its value display is like this character �.
So how can i format the "NaN" Value?
actually i think it is meaningless to format the "NaN" value , but i want to know
why the below code is return junk character value.
value[0] = myFormatter.format(Double.parseDouble(value[0]));
Pls provide me the proper solution of my above case.
Thanks in advance
Yatin Baraiya
- 06-06-2012, 03:17 PM #2
Re: DecimalFormat fromat method return junk chacter , formate with this value "NaN"
Where does the one-element String array figure in your problem? Why didn't you use a simple String variable?
Or did you think it might be fun to obscure the real issue with something irrelevant?
Also, go through
Forum Rules
Guide For New Members
BB Code List - Java Programming Forum
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 06-06-2012, 03:41 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,399
- Blog Entries
- 7
- Rep Power
- 17
Re: DecimalFormat fromat method return junk chacter , formate with this value "NaN"
That's just the way how it formats a NaN value; it formats infinity as ∞ b.t.w.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-07-2012, 09:16 AM #4
Member
- Join Date
- Jun 2012
- Posts
- 2
- Rep Power
- 0
Re: DecimalFormat fromat method return junk chacter , formate with this value "NaN"
- 06-07-2012, 09:24 AM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,399
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
java error "invalid method declaration;return type required"
By intercroc in forum New To JavaReplies: 17Last Post: 05-28-2012, 08:30 PM -
Simple "Global" function to return random int
By mac666 in forum New To JavaReplies: 2Last Post: 01-10-2012, 03:13 PM -
Getting more than one "return" from a method
By Mapisto in forum New To JavaReplies: 49Last Post: 12-17-2011, 11:01 PM -
[SOLVED] Why does the compiler return "not a statement" for this method body please?
By trueblue in forum New To JavaReplies: 3Last Post: 05-25-2009, 08:50 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks