Ad
  • Default User Avatar

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

  • Custom User Avatar

    This kata seems has some logical issues(my opinon) like if "foobar00" --> "foobar01" (here second last 0 wasn't excluded) then "foobar099" --> "foobar100" (why the 3rd last zero wasn't included!? It could be "foobar0100")

  • Custom User Avatar

    That's a problem with your code, not a kata issue. The first value in the error message is what your function returns, not the input. To see it, print it.

  • Custom User Avatar

    'foobar910' should equal 'foobar100'
    Do explain the logic behind this !!!

  • Custom User Avatar

    Print the input, the first value in the error message is what your function wrongly returned instead of the expected value. It's even explained in the post directly below yours. Also, the number you should increase is the one at the end, not any number in the string:

    If the string already ends with a number, the number should be incremented by 1.

  • Default User Avatar

    My solution fails due to: "'fo100obar100' should equal 'fo99obar100'" - IMO it should be 'fo101obar101'...

  • Custom User Avatar

    If the number ends in 99, 9, or 999, 0 must be subtracted

  • Default User Avatar

    it said foobar1 should equal foobar001

    This is how the test suite provides you with the information:

    String = 'foobar000': 'foobar1' should equal 'foobar001'

    For the test "foobar000", your code incorrectly returns "foobar1", not a kata issue.

  • Custom User Avatar

    foobar1 = foobar2 in the output suggestion but when test it said foobar1 should equal foobar001 ??? this kata is the worst

  • Default User Avatar

    You need to keep the zeros if they have another number in front of them like 0045 or 087. Don't keep them if when you increment the number the digits are the same.

  • Default User Avatar

    One of the worst problems ever. What does it mean "If the number has leading zeros the amount of digits should be considered."? The test examples make no sense: foo0042 -> foo0043 and foo099 -> foo100. When to keep the zeros and when not?

  • Default User Avatar

    As a first-learner, this was very hard, educating and satisfying to solve. Hardest one so far.

  • Custom User Avatar

    OP solved it, closing

  • Custom User Avatar

    OP solved it, closing

  • Custom User Avatar

    OP solved it, closing

  • Loading more items...