🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Converting a string number to integer

#17622
From: Jonathan McGuire
Date: Fri, 09 Oct 1998 00:00
39 lines
1547 bytes
Better,  Integer.parseInt is a static method.

So, just

int i = Integer.parseInt(txtField1.getText());

Jonathan McGuire
Director, Product Development
iMark
mcguire@itribe.net

Dillan Fernando wrote in message <6vlqao$2jm8@forums.borland.com>...
>Hi Vasudevan.
>
>Try this.
>
>int i = new Integer("100").parseInt(txtField1.getText());
>
>note: the "100" is just a dummy value to construct an Integer Class
>
>Hope this helps !
>
>Regards
>Dillan Fernando
>Senior Analyst
>Palmware (pvt) Ltd.
>Sri Lanka
>
>Vasudevan Srinivasan wrote in message <361D16E6.CC7B2C81@netrisk.com>...
>>Hi
>>i had tried that one, but valueOf(...) returns Integer class not int type.
>so
>>i got a compilation error.
>>anyway now i have rewritten the code as:
>>int iv = (new Integer(text.getText()).intValue();
>>but i would like to know the scope of this Integer class - thru out the
>>existance of the program or only until the end of the function.
>>thanks
>>
Technical Details
Message-ID: <361e79f6.0@news.itribe.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <361CDD1E.D3894642@netrisk.com> <MPG.1086bb539839fd1d9896a4@forums.borland.com> <361D16E6.CC7B2C81@netrisk.com> <6vlqao$2jm8@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,698598ce65fb7690
X-Google-Attributes: gidf74b3,public
From: "Jonathan McGuire" <mcguire@itribe.net>
Subject: Re: Converting a string number to integer
Date: 1998/10/09
Message-ID: <361e79f6.0@news.itribe.net>
X-Deja-AN: 399659698
References: <361CDD1E.D3894642@netrisk.com> <MPG.1086bb539839fd1d9896a4@forums.borland.com> <361D16E6.CC7B2C81@netrisk.com> <6vlqao$2jm8@forums.borland.com>
Newsgroups: borland.public.jbuilder.java.language
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3