CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: easy question

  1. #1
    Join Date
    Sep 1999
    Location
    Utah [Zion]
    Posts
    667

    easy question

    I know this is easy.. I am coming to java from a long time in C/C++. How do you easily convert a String to an int? sounds easy right? Well, tell me if you know cause I can't figure it out and the MSDN I have doesn't know either. it is a simple atoi() call in C++, but what about java? I am using MS J++.
    thanks java people!


  2. #2
    Join Date
    May 2000
    Location
    NJ,USA
    Posts
    64

    Re: easy question

    Hi, In java we have wrapper classes to do this. If u want to convert to a string to int, do like this...
    try
    {
    String str = "23";
    int value = java.lang.Integer.parseInt(str);
    System.out.println(val);
    }
    catch (Exception e) { }

    Sreeni
    #If this post is valid to u, then dont forget to rate it#


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured