We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I was working with Swift, and Foundation has a spell out style number formatter. So I decided to use it.
Passed all the "open" test cases, failed two of the locked ones. Made the example section into another batch of test cases, and low and behold I was generating "twenty-eight minutes past five" and the example had no dash.
So anyone else deciding to save time by using the built in Foundation number formatter (hey if it were a real world job I would be upset at a PR trying to spell out numbers and not just using the libary without good reason!) should be aware they need to post process hyphens into spaces....
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Time in Words
You are viewing a single comment's thread. Return to all comments →
Live by the library, die by the library I guess.
I was working with Swift, and Foundation has a spell out style number formatter. So I decided to use it.
Passed all the "open" test cases, failed two of the locked ones. Made the example section into another batch of test cases, and low and behold I was generating "twenty-eight minutes past five" and the example had no dash.
So anyone else deciding to save time by using the built in Foundation number formatter (hey if it were a real world job I would be upset at a PR trying to spell out numbers and not just using the libary without good reason!) should be aware they need to post process hyphens into spaces....