:deps {dharrigan/numords {:mvn/version "0.0.1"}}
Numords is a very simple, limited, library that converts Western
Arabic numbers, such as 99
, 4
, -1
, 1000
, 4123
into their respective
British English words, i.e., ninety nine
, four
, minus one
, one
thousand
, four thousand one hundred and twenty three
and so
on…you get the drift 😃
I couldn’t think of anything better 😆
This project follows the version scheme MAJOR.MINOR.COMMITS
where
MAJOR
and MINOR
provide some relative indication of the size of
the change, but do not follow semantic versioning. In general, all
changes endeavor to be non-breaking (by moving to new names rather
than by breaking existing names). COMMITS
is an ever-increasing
counter of commits since the beginning of this repository.
This library can be pulled in via standard Clojuresque dependency
management tooling such as deps
, leiningen
or boot
. An example
using deps
is shown below:
:deps {dharrigan/numords {:mvn/version "0.0.1"}}
The version number may have moved on since this document
was written. Please refer to the CHANGELOG.md for the current
version.
|
(require '[numords.core :as numords])
(numords/number->words -1) ;; minus one
(numords/number->words -1.1) ;; minus one point one
(numords/number->words 0) ;; zero
(numords/number->words 0.1) ;; zero point one
(numords/number->words 999) ;; nine hundred and ninety nine
(numords/number->words 999.1) ;; nine hundred and ninety nine point one
(numords/number->words 1000) ;; one thousand
(numords/number->words 2500) ;; two thousand five hundred
(numords/number->words 3333.345) ;; three thousand three hundred and thirty three point three four five
A script to run all tests can be found here:
bin/kaocha
Right now, numords
can only process numbers up to ±999,999,999
.
Pull requests are very much welcome! 👷 |
I welcome feedback. I can usually be found hanging out in the #clojure-uk
channel on Clojurians Slack. You can also email
me if you wish :-)
Please do contribute if you wish! Issues and pull requests are welcome.
Nothing special is required. A good text editor, a working Clojure development setup and away you go! I use clj-kondo to lint my code. You should consider using it too 😊.
Find the full unlicense in the UNLICENSE
(and
LICENSE
) file, but here’s a snippet:
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
Enjoy!
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close