Expand description
§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