How to covert String("6,400.0") to Double ?

Discussion in 'Java' started by Guest, Jul 28, 2005.

  1. Guest

    Guest Guest

    public static double removePeriod(String format) {
    double a = 23.0;
    format = "23.0";
    a = Double.parseDouble(format,10);
    return a;
    }
    Guest, Jul 28, 2005
    #1
    1. Advertising

  2. wrote:
    > public static double removePeriod(String format) {
    > double a = 23.0;
    > format = "23.0";
    > a = Double.parseDouble(format,10);
    > return a;
    > }


    Is that supposed to be a question?

    May I recommend that you read

    http://www.yoda.arachsys.com/java/newsgroups.html

    and
    http://www.catb.org/~esr/faqs/smart-questions.html

    particular

    http://www.catb.org/~esr/faqs/smart-questions.html#beprecise

    and follow that advice prior to posting?

    You might also want to consider posting to comp.lang.java.help instead.
    But also, read and follow the above advice before posting here ore there.

    /Thomas

    --
    The comp.lang.java.gui FAQ:
    ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
    http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
    Thomas Weidenfeller, Jul 28, 2005
    #2
    1. Advertising

  3. Guest

    Roedy Green Guest

    On Thu, 28 Jul 2005 16:07:47 +0800, <> wrote
    or quoted :

    > double a = 23.0;
    > format = "23.0";
    > a = Double.parseDouble(format,10);
    > return a;
    > }

    for all your conversion problems consult
    http://mindprod.com/applets/converter.html

    --
    Bush crime family lost/embezzled $3 trillion from Pentagon.
    Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
    http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

    Canadian Mind Products, Roedy Green.
    See http://mindprod.com/iraq.html photos of Bush's war crimes
    Roedy Green, Jul 28, 2005
    #3
  4. Guest

    Guest Guest

    test_double.java:10: Method parseDouble(java.lang.String) not found in class
    jav
    a.lang.Double.
    t = Double.parseDouble("-12000.001");

    Compile error on java version "1.1.3". it is ok on java version
    "Roedy Green" <> wrote in message
    news:...
    > On Thu, 28 Jul 2005 16:07:47 +0800, <> wrote
    > or quoted :
    >
    > > double a = 23.0;
    > > format = "23.0";
    > > a = Double.parseDouble(format,10);
    > > return a;
    > > }

    > for all your conversion problems consult
    > http://mindprod.com/applets/converter.html
    >
    > --
    > Bush crime family lost/embezzled $3 trillion from Pentagon.
    > Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
    > http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
    >
    > Canadian Mind Products, Roedy Green.
    > See http://mindprod.com/iraq.html photos of Bush's war crimes
    Guest, Jul 29, 2005
    #4
  5. On Fri, 29 Jul 2005 10:40:42 +0800, <> wrote:

    > test_double.java:10: Method parseDouble(java.lang.String) not found in class
    > jav
    > a.lang.Double.
    > t = Double.parseDouble("-12000.001");
    >
    > Compile error on java version "1.1.3".


    Yes. Double.parseDouble(String) was introduced in 1.2.

    Where on Earth did you get a 1.1.3 SDK from?

    ( And why on Earth are you *using* it? )

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    It's Like "Hee Haw" With Lasers
    Andrew Thompson, Jul 29, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?aGVuaw==?=

    Covert UTC String to UTC Datetime

    =?Utf-8?B?aGVuaw==?=, May 7, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    18,706
    Egbert Nierop \(MVP for IIS\)
    May 7, 2006
  2. Morgan Cheng
    Replies:
    4
    Views:
    616
    Morgan Cheng
    Dec 17, 2004
  3. Sydex
    Replies:
    12
    Views:
    6,453
    Victor Bazarov
    Feb 17, 2005
  4. Jim Florence
    Replies:
    3
    Views:
    6,788
    Ken Cox [Microsoft MVP]
    Jun 25, 2006
  5. Jeff
    Replies:
    2
    Views:
    784
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Apr 16, 2007
Loading...

Share This Page