Ad
  • Custom User Avatar

    Didn't you wonder that so many guys passed the kata and nobody said something?
    It can be a bit difficult to explain but the two functions are inverse of each other; below examples taken from basic tests:

      dec2_fact_string(fact_string_2dec("27A0533231100".to_string()))); has to return "27A0533231100"
      fact_string_2dec(dec2_fact_string(1273928000))); has to return 1273928000
    

    But with your functions here is what I get:

      println!("{}", dec2_fact_string(fact_string_2dec("27A0533231100".to_string()))); -> 2860533231100 instead of "27A0533231100"
      println!("{}", fact_string_2dec(dec2_fact_string(1273928000))); -> 1299329600 instead of 1273928000
    

    When you pass from a number written x in base a to that number written y in base b and then pass y from base b to base a you expect to find again x.
    Nevertheless lots of thanks for your post which is very instructive.
    I mark the issue as resolved but if you don't agree or if you find that my explanations are too short please tell it.