Function endinero::endinero_f64

source ·
pub fn endinero_f64(
    amount: f64,
    max_decimal_places: u16,
    zero_comma_decimal_places: u16,
    thousands_separator: char,
    radix_character: char,
    decimals_separator: char
) -> String
Expand description

Copyright [2022] DiarioBitcoin.com, Angel Leon

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Customize the separator characters and decimal precision used to format the output of the given f64 number

Parameters:

amount: f64: the original amount in f64

max_decimal_places: u16: number of decimal digits to keep for amounts > 0

zero_comma_decimal_places: u16: number of decimal digits to keep for amount < 1

thousands_separator: char: character to be used to separate thousands on the integer part of amount

radix_character: char: character that separates the integer portion from the decimal portion (e.g. . for numbers in US locale but , for numbers in Spanish locales)

decimal_separator: char: character that separates decimal portions every thousandth