Hi all, I noticed the provided solution for String-3 -- withoutString is incorrect
It preserves only a single space in between matches when it should preserve all spaces. For example:
withoutString("This is a FISH", "IS") returns "Th░a░FH" (length 7) when it should return "Th░░a░FH" (length 8)
💡 spaces replaced by ░
This RegEx approach then doesn't pass all the tests in CodingJS, but the same approach in Java does in CodingBat.com
function withoutString(base, remove){
let reg = new RegExp(remove, 'gi')
return base.replace(reg, '')
}
The same approach in Java in the Official CodingBat String-3 > withoutString
public String withoutString(String base, String remove) {
return base.replaceAll("(?i)" + remove, "");
}
Is this project active? I could submit a PR for this. I'm also interested in becoming a longer term contributor as some of my students use your website.
Hi all, I noticed the provided solution for String-3 -- withoutString is incorrect
It preserves only a single space in between matches when it should preserve all spaces. For example:
withoutString("This is a FISH", "IS")returns"Th░a░FH"(length 7) when it should return"Th░░a░FH"(length 8)💡 spaces replaced by ░
This RegEx approach then doesn't pass all the tests in CodingJS, but the same approach in Java does in CodingBat.com
The same approach in Java in the Official CodingBat String-3 > withoutString
Is this project active? I could submit a PR for this. I'm also interested in becoming a longer term contributor as some of my students use your website.