Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Ronnie Mccoy   on May 14 In Java Category.

  
Question Answered By: Taylor White   on May 14

But also, your first "substring" statement is wrong.
As you have it - substring (0) - it simply returns the whole string, you need a
second parameter to define the length  of the substring. In your case, that'll
be "index" or "index - 1" I would think.

BTW If you want this code  to be efficient, you should look at the "replaceAll"
method which will do what you want much faster, I'd think. If it's just a
programming exercise, your approach is fine.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on problem with code Or get search suggestion and latest updates.


Tagged: