Results 1 to 2 of 2
  1. #1
    javanewbie is offline Member
    Join Date
    Jun 2008
    Location
    Australia
    Posts
    43
    Rep Power
    0

    Question [SOLVED] Substring Method

    Here's the scenario:

    Let's say I have three inputs:


    24234234 - sdfjkshfjkh
    12312 - 2k34jkljdfser
    1231445 - aasdjkdvsdfnm

    What the output should be:

    24234234
    12312
    1231445

    Any suggestions?

  2. #2
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    6

    Default

    just use myString.substring(0,myString.indexOf('-')-1);
    I die a little on the inside...
    Every time I get shot.

Similar Threads

  1. Reverse a string not using the substring method
    By kathyla18 in forum New To Java
    Replies: 17
    Last Post: 04-08-2009, 04:08 AM
  2. Help with substring
    By hiklior in forum New To Java
    Replies: 12
    Last Post: 06-28-2008, 06:48 AM
  3. How can i get substring
    By 82rathi.angara in forum New To Java
    Replies: 14
    Last Post: 06-27-2008, 04:35 AM
  4. How to use subString method
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:44 PM
  5. substring
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-11-2007, 08:15 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
  •