dollars
Version, currently master branch1 version
- master branchlatestApr 22, 2017
github.com/kimburgess/dollar-conversion
Simple coding challenge and an excuse to play around with Crystal Lang!
Installation
# Add this to your shard.yml
dependencies:
dollars:
github: kimburgess/dollar-conversion
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.20.5- License
- MIT
- Author
- Kim Burgess
- Target
dollarsfrom src/dollars.cr
Dependencies
Runtime Dependencies
- cli*github: mosop/cli
README
Data manipulation / coding challenge that a friend was given for an interview question. Thought it would be fun to attempt to implement and a good excuse to take a new language (Crystal) for a spin.
Original brief and requirements:
Write a function (dollars) that accepts a
Stringand returns aString. It will accept a numeric value as input, representing an amount of money, and the function will convert that value to its how it is written in English. Use any preferred programming language. For example, the input "1.11" will result in a return value of "one dollar and eleven cents"
Invalid characters should be ignored, meaning that every input string has an output string. The empty string produces "zero dollars and zero cents"
Some other example input and output:
dollars "0" => "zero dollars and zero cents"
dollars "1" => "one dollar and zero cents"
dollars "0.1" => "zero dollars and ten cents"
dollars "1." => "one dollar and zero cents"
dollars "0." => "zero dollars and zero cents"
dollars ".34" => "zero dollars and thirty-four cents"
dollars "0.3456789" => "zero dollars and thirty-four cents"
dollars "1.0" => "one dollar and zero cents"
dollars "1.01" => "one dollar and one cent"
dollars "1000456.13" => "one million four hundred and fifty-six dollars and thirteen cents"
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Apr 22, 2017
- Crystal
0.20.5- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/kimburgess/dollar-conversion
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 25, 2026
- Synced
- Sep 25, 2026
- Versions
- 1