Ad
  • Custom User Avatar

    Hahaha definitely :]

    To be honest I often do not focus on producing the cleanest solution while doing Katas and I was a bit surprised about the harsh remark by the other commenter!

    So thanks for chiming in.

  • Custom User Avatar

    I love this. It's easy to understand and makes great use of lots of Kotlin's handy helper methods. I had no idea that substringAfter existed, along with the singleOrNull method. That's what I get for just starting with the language!

  • Custom User Avatar

    I would avoid hardcoding what a valid town can be. While that might work on the test cases presented here, it would only take an additional test or two to cause this code to break. Instead, I would rely on the data given to you, and figure out a way to parse that to determine what a valid town is. That allows your code to be much more flexible in what it can handle.

  • Custom User Avatar

    I think that "unreadable crap" is a bit harsh, but this seems a little more in the realm of a code golfing solution. While it does get the job done, if you were to come back to this a few weeks later, I think you'd be a little mad at past you for unnecessarily obfuscating your code.