2 releases
0.1.1 | Nov 10, 2022 |
---|---|
0.1.0 | Oct 28, 2022 |
#262 in Value formatting
68 downloads per month
15KB
294 lines
rust number to words
A Rust crate to convert numbers into words
This is based on a C# program by Jonathan Wood (www.softcircuits.com)
Converts a number into a string of words.
**Examples:**
12345.6789 outputs twelve thousand three hundred forty-five and 68/100
345 outputs three hundred forty-five
lib.rs
:
A function to convert a number to a string of words.
Copyright (c) NexPro 2022
Based on C# version by Jonathan Wood
Copyright (c) 2019-2020 Jonathan Wood (www.softcircuits.com)
Licensed under the MIT license. see: https://mit-license.org/
Liabilities
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Purpose:
Converts a number to a rust std::string String representation of the number in words with the part after the decimal point represented as xx/100
Typical uses would be for cheque printing or remittance notices.
**Examples:**
Calling number_to_words(99988389.123, true) will return the String:
Ninety-nine million, nine hundred eighty-eight thousand, three hundred eighty-nine and 12/100
Calling number_to_words(99988389.123, false) will return the String:
ninety-nine million, nine hundred eighty-eight thousand, three hundred eighty-nine and 12/100
Calling number_to_words(10.0, true) will return the String:
Ten *
**Errors:**
Numbers greater than 9_999_999_999_999.99 will return the String: Number too large
Dependencies
~465KB