Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    583 people understood this description and solved the kata without problems.
    I also understand it. So where is your problem?

  • Default User Avatar

    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.

  • Default User Avatar

    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 :)

  • Default User Avatar

    I added an extra line in the example. :-)

  • Default User Avatar

    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. :-)

  • Default User Avatar

    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!'

  • Default User Avatar

    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