Results 1 to 2 of 2
  1. #1
    Vingilot is offline Member
    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    Default Selecting certain number from string consisting of numbers

    If i want to compare to numbers in strings containing numbers, such as the 1 in the string 12345 and the 2 in string 21345 how could this be done? My friend told me I could parseint them but I'm not familiar with parsing,thanks!

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default Re: Selecting certain number from string consisting of numbers

    Converting Between Numbers and Strings (The Java™ Tutorials > Learning the Java Language > Numbers and Strings)

    Oracle's Tutorial page at that link talks about floating point numbers rather than integers, but the idea is the same. The parseInt() method they talk about is fully described in its API docs.

Similar Threads

  1. Replies: 12
    Last Post: 03-28-2011, 10:30 PM
  2. Replies: 6
    Last Post: 12-06-2010, 10:26 AM
  3. Taking args consisting of a scanner input
    By Implode in forum New To Java
    Replies: 1
    Last Post: 09-27-2009, 10:16 PM
  4. printing number of pos/neg numbers input?
    By shroomiin in forum New To Java
    Replies: 12
    Last Post: 09-25-2009, 03:15 AM
  5. trying to add up random numbers into one number
    By pjr5043 in forum New To Java
    Replies: 4
    Last Post: 09-15-2008, 03:20 PM

Posting Permissions

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