Ad
  • Default User Avatar

    Thanks for clarifying 👍

  • Custom User Avatar

    In 'foobar0100' should equal 'foobar100' the first value is what your function returned, not the input. To see the input, print it.

  • Default User Avatar

    I got 'foobar0100' should equal 'foobar100'
    ...but shouldn't it be 'foobar0100' should equal 'foobar0101' instead?

  • Default User Avatar

    "foobar00" turns into "foobar01" because the end result after the string was incremented was 2, which did not take up both digits. If it was "foobar09", then it would turn into "foobar10", because the result now takes up both zeros which were in the input. In the case of "foobar099", 99 turns into 100, meaning it now takes up 3 digits. In "foobar099", there are 3 numbers at the end, so you would not include the extra 0 after incrementation.

  • Custom User Avatar
  • Custom User Avatar

    OP solved it, closing

  • Default User Avatar
    Test failed with s = "VLntuZwiiuRPgUb99999999999999999999999999999999999999999999999999999999999999999999999999999"
    Expected "VLntuZwiiuRPgUb100000000000000000000000000000000000000000000000000000000000000000000000000000"
    But got "VLntuZwiiuRPgUb99999999999999999999999999999999999999999999999999999999999999999999999999999" at src/lib.rs:59:9
    

    I hate this one

  • Default User Avatar

    Nice Kata!

  • 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.

  • Loading more items...