troubleshooting Question


Avatar of keepworking
keepworking asked on
10 Comments1 Solution193 ViewsLast Modified:
//this method will remove the text between [ and ], the input string may contains more than 1 pair of [].

it doesn't work, please let me know what is wrong in this recursion method. thanks

public static String remove_text(String text) throws IOException{

       String text_after = null;
           int begin_index =text.indexOf("[");
           int end_index =text.indexOf("]");
           text_after = text.substring(0,begin_index-1) + text.substring(end_index+1, text.length()-1);          
       return text_after;
return text;
Mick Barry
Java Developer
Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros