Discussion Board

Results 1 to 2 of 2

Thread: problem in code

  1. #1
    Registered User kapilkumarnegi's Avatar
    Join Date
    Jul 2010
    Posts
    15
    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 grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    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 C++
    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 C++
    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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved