Thanks for posting Ioannis, good job!
You can take this to the next level with Replace conditional with Polymorphism. Even though you have successfully improved the code in this example, every new format will require you to modify this algorithm.
Great! Thanks for sharing.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.