×

Discussion Board

Results 1 to 2 of 2

Thread: problem in code

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    15

    problem in code

    after executing the code its showing the error "String Index out of range " i could not find my fault so please help me

    NOTE : before running the application copy MYFILE.TXT in the memory card and make empty files of BACKUP.TXT and TEMPERARY.TXT its important

    FILES NEEDED ARE:
    SOURCE FILE : process.java =>http://www.megafileupload.com/en/fil...cess-java.html
    MYFILE.TXT : => http://www.megafileupload.com/en/fil...YFILE-TXT.html

    please dont change the content of the file
    please help me
    thanks

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: problem in code

    Looks like:

    Code:
    for (int i=0;i<str.length();i++)
    {
         if((str.substring(i,i+4)).equalsIgnoreCase("()[]"))
    String.substring() throws a StringIndexOutOfBoundsException if the endIndex is greater then the length of the string.

    No need to use equalsIgnoreCase() when there is no case to match.

    You might find it more efficient to use String.indexOf().

    Graham.

Similar Threads

  1. what is the problem with this code?
    By raj8nokiaforum in forum Symbian
    Replies: 18
    Last Post: 2008-10-08, 14:38
  2. what is the problem in my code????????
    By jennie in forum Symbian User Interface
    Replies: 21
    Last Post: 2007-11-05, 09:09
  3. Replies: 3
    Last Post: 2007-01-18, 11:27
  4. Replies: 0
    Last Post: 2003-09-26, 15:07
  5. Code problem.
    By giudicea in forum Symbian
    Replies: 0
    Last Post: 2003-09-25, 10:28

Posting Permissions

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