Article View: borland.public.jbuilder.java.language
Article #15050Re: StrToInt function?
From: Dave Hatzenbuehler
Date: Tue, 13 Jul 1999 00:00
Date: Tue, 13 Jul 1999 00:00
38 lines
1680 bytes
1680 bytes
Steve,
Sorry for the screw up, I should have done, cStr = '123'; But you got the
picture and I appreciate your help, it worked.
Thanks again,
Dave Hatz
"Steve Schafer (TeamB)" wrote:
> On Tue, 13 Jul 1999 09:20:29 -0700, Dave Hatzenbuehler
> <daveh@insynclh.com> wrote:
>
> >I am looking for a way to convert a string to an integer value. I have
> >the following line of code:
> >
> >String cStr = 'abc';
> >int nNum = Integer.valueOf( cStr ).intValue.
> >
> >I keep getting "intValue not found in java.lang.Integer." I have import
> >java.lang.Integer and I still get this error.
>
> intValue() is a method, not a field, so you have to include the
> trailing empty parentheses. That said, however, it's not clear to me
> what you expect the integer value of the string "abc" to be.
>
> Here's a complete program that shows the idea:
>
> public class Test {
>
> public static void main(String[] argv) {
> String cStr = "123";
> int nNum = Integer.valueOf(cStr).intValue();
> System.out.println(nNum);
> }
>
> }
>
> -Steve
Technical Details
Message-ID:
<378BCCD4.85A325A1@insynclh.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<378B674D.8818D1F6@insynclh.com> <37b775c2.306103649@90.0.0.40>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,ecbec2f1a10fd049 X-Google-Attributes: gidf74b3,public From: Dave Hatzenbuehler <daveh@insynclh.com> Subject: Re: StrToInt function? Date: 1999/07/13 Message-ID: <378BCCD4.85A325A1@insynclh.com> X-Deja-AN: 500715570 Content-Transfer-Encoding: 7bit References: <378B674D.8818D1F6@insynclh.com> <37b775c2.306103649@90.0.0.40> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language