#numbers #banking #finance #utility #thousands

bin+lib number_to_words

Converts number to words

2 releases

0.1.1 Nov 10, 2022
0.1.0 Oct 28, 2022

#262 in Value formatting

Download history 14/week @ 2024-03-11 8/week @ 2024-03-18 5/week @ 2024-03-25 71/week @ 2024-04-01 10/week @ 2024-04-08 6/week @ 2024-04-15 22/week @ 2024-04-22 12/week @ 2024-04-29 10/week @ 2024-05-06 7/week @ 2024-05-13 13/week @ 2024-05-20 7/week @ 2024-05-27 14/week @ 2024-06-03 9/week @ 2024-06-10 28/week @ 2024-06-17 16/week @ 2024-06-24

68 downloads per month

MIT license

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