How can I replace it?
I’ve been trying this:
string.replaceFirst(substring, "");
but it’s not replacing, and as I am doing a recursive method, it’s giving me a StackOverflowException..
Any idea?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
String are immutable, which means you cannot change them once they are initialized.
The
replaceFirstmethod creates a new string where the first instance is replaced by your replacement and returns it…the original string is never modified.You’re code should be something like this