🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16681

Re: Parsing String to Integer

#16681
From: Jeff Rafter
Date: Thu, 21 Jan 1999 00:00
15 lines
995 bytes
Ginny,

I was having the same sort of problem with a double.  I used valueOf instead
and converted the Double to a double, as follows.

      Double x = new Double(0);
      try {
        x = Double.valueOf(s);
      } catch( NumberFormatException e ) { x = Double.valueOf("0"); }
      double d = x.doubleValue();

This is probably way slower though.  I don't know.

Jeff Rafter
Realsoft Development
Technical Details
Message-ID: <787ug4$h4i3@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36A76DBD.3F6735BD@consultec.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,256c646a4b3cb6c9
X-Google-Attributes: gidf74b3,public
From: "Jeff Rafter" <jeffrafter@earthlink.net>
Subject: Re: Parsing String to Integer
Date: 1999/01/21
Message-ID: <787ug4$h4i3@forums.borland.com>
X-Deja-AN: 435328206
References: <36A76DBD.3F6735BD@consultec.de>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.0810.800
Organization: Realsoft Development
X-MSMail-Priority: Normal
Reply-To: "Jeff Rafter" <jeffrafter@earthlink.net>
Newsgroups: borland.public.jbuilder.java.language