Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
583 people understood this description and solved the kata without problems.
I also understand it. So where is your problem?
Agree with pre, the description does not explain what is requested properly. Examples therefore contradict each other. Wasted time trying to code for something that was not described correctly.
Thanks, I figured it out after much trial and error. I suggest changing the description from "Write a method, that replaces every nth char oldValue with char newValue."
to
"Write a method that replaces every nth occurence of char oldValue with char newValue. That is, every nth time oldValue appears, not every nth character in text"
Hopefully makes it less confusing. The extra line counting the nth occurrences helps a lot -- please consider changing that slightly: "Pos 2 and 4 are replaced"
to
"2nd and 4th occurence are replaced"
Finally, typo down little lower: "casesensitive" should be case sensitive :)
I added an extra line in the example. :-)
You should replace every nth char. NOT ONLY beginning at the nth char.
"Abcabcabcabc", 2, 'b', '' -> "Abcacabca*c"
-> The 2nd and the 4th 'b' are replaced.
Hope now, it is clearer. :-)
My problem exactly. I have code working for ever Nth character, but Vader should be replaced too (?)
Expected: 'Vader soid: No, I am your fother!', instead got: 'Voder soid: No, I am your fother!'
Isn't the first assert wrong?
Test.assertEquals(replaceNth("Vader said: No, I am your father!", 2, 'a', 'o'), "Vader soid: No, I am your fother!");
It says to replace every 'a' beginning with the second with 'o'.
Also the 'a' from 'I am' should be 'I om'
Also last test from basic tests.
Thanks