I like this kata :)
Ruby translation kumited -- please check and approve
I just did this kata and had a similar solution to those posted(though longer and uglier). It only works for 4 digit prices though. When I ran my solution I came across a bunch of prices with 5 or 3 digits, which messed up my whole algorithm . It was not clear to me that there would be prices of varying length (which make the re pattern more complex and this kata way harder)
The first point is still outstanding.
It's not explained anywhere why $5.$6.6x.s4 becomes $56.64 and not $5.664 or $5664 or $566.4
Also, leading zeros don't make much sense (as alread reported earlier)
Performance isn't the only thing to consider. In practice error handling is important and properly handling errors leads to easier to maintain code.
Why is try/catch considered "Best Practice"? Surely that would less performant than figuring out if the index is valid yourself.
Not a issue.
Fixed. Thank you for reporting.
Why I'm need to import re if i don't use them?
Hi, I have a couple of suggestions about this kata:
that was fun =)
Sorry, forgot to include the last element for some reason. :P
Should be fixed.
Sorry about that! You are right, it should include all items in the list!
Should be fixed now!