Article View: aus.computers.java
Article #314Re: Help! String as Integer
From: rastgoo
Date: Thu, 31 May 2001 21:02
Date: Thu, 31 May 2001 21:02
32 lines
2015 bytes
2015 bytes
Luke Vanderfluit <luke@chipcity.com.au> wrote in message
news:3A63FC90.3C832EFA@chipcity.com.au...
> Hi
>
> I need help with this.
> Why doesn't the following code work?:
> I need to interpret a line of text as an integer.
>
> String a = "yes";
> String b = "ls";
> int aa = Integer.valueOf("foo").intValue();
> int bb = Integer.valueOf("bar").intValue();
> System.out.println(aa);
> System.out.println(bb);
>
> This throws a NumberFormatException
>
> How can I read a String as an Integer
>
> Can you help me please.
>
> Desperate,
> --
> Luke Vanderfluit
>
> Phone 61 8 8556 6112
>
> Aldinga Beach, South Australia
>
>
>
Technical Details
Message-ID:
<3b16b1bd_3@news.bizonline.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!skynet.be!bnewspeer01.bru.ops.eu.uu.net!lnewspeer00.lnd.ops.eu.uu.net!lnewspost00.lnd.ops.eu.uu.net!emea.uu.net!not-for-mailReferences:
<3A63FC90.3C832EFA@chipcity.com.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113ae9,7de64e08ee658586 X-Google-Attributes: gid113ae9,public X-Google-Thread: 10d6db,7de64e08ee658586 X-Google-Attributes: gid10d6db,public X-Google-Thread: 10a146,5f124143cc4771e2,start X-Google-Attributes: gid10a146,public X-Google-ArrivalTime: 2001-05-31 15:12:49 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!skynet.be!bnewspeer01.bru.ops.eu.uu.net!lnewspeer00.lnd.ops.eu.uu.net!lnewspost00.lnd.ops.eu.uu.net!emea.uu.net!not-for-mail Reply-To: "rastgoo" <rastgoo@thefreeinternet.co.uk.NOSPAM> From: "rastgoo" <rastgoo@thefreeinternet.co.uk.NOSPAM> Newsgroups: aus.computers.java,comp.lang.java.programmer,comp.lang.java.help References: <3A63FC90.3C832EFA@chipcity.com.au> Subject: Re: Help! String as Integer Date: Thu, 31 May 2001 22:02:42 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: <3b16b1bd_3@news.bizonline.net> X-Comments: Business Online do NOT condone SPAM or illegal postings X-Abuse-To: abuse@bizonline.net X-Original-NNTP-Posting-Host: 213.108.23.189 Lines: 34 NNTP-Posting-Host: maxheadroom.bizonline.net X-Trace: 991347167 beta.news.uk.uu.net 12243 212.95.128.244 X-Complaints-To: abuse@uk.uu.net