Results 1 to 2 of 2
  1. #1
    ashishb4 is offline Member
    Join Date
    May 2011
    Posts
    8
    Rep Power
    0

    Default String index out of range: -1 due to length function

    The problematic line is:

    logResponse = logResponse.substring(j,logResponse.length());

    I think in substring while I am checking length,it is returning -1,

    String index out of range: -1 is the error.

    Could you please tell me what does it mean(length returning -1) and how to handle it and throw proper exception.

    Thanks,
    Ashish

  2. #2
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    5

    Cool

    Don't create multiple threads for the same problem.

    Your problem is getting attended here already : String index out of range: -1 Error

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

Similar Threads

  1. String index out of range: -1 Error.
    By ashishb4 in forum New To Java
    Replies: 12
    Last Post: 09-28-2011, 07:32 PM
  2. Array index out of range: 1 HELP!
    By TheBreadCat in forum New To Java
    Replies: 2
    Last Post: 02-17-2011, 08:50 PM
  3. Replies: 2
    Last Post: 01-07-2011, 11:50 AM
  4. String index out of range: -1 Please Help
    By davetheant in forum New To Java
    Replies: 22
    Last Post: 09-11-2010, 12:32 AM
  5. Passing an Array index into a function?
    By dpedroia15 in forum New To Java
    Replies: 3
    Last Post: 06-01-2010, 07:51 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
  •