pub fn amount_to_hr_string(&self, amount: u64, truncate: bool) -> String {
		let exp = self.exponent();
		let a = format!("{}", amount);
		let len = a.len();
		let pos = len.saturating_sub(exp);
		let (characteristic, mantissa_prefix) = if pos > 0 {
			(&a[..(len - exp)], String::new())
		} else {
			("0", "0".repeat(exp - len))
		};
		let mut mantissa = &a[pos..];
		if truncate {
			let nzeroes = mantissa.chars().rev().take_while(|c| c == &'0').count();
			mantissa = &a[pos..(a.len().saturating_sub(nzeroes))];
			if mantissa.len() == 0 {
				mantissa = "0";
			}
		}
		format!("{}.{}{}", characteristic, mantissa_prefix, mantissa)
	}
/// Print amount in nano coins normally
Print amount in nano coins normally
Print amount in nano coins normally
pub fn amount_to_hr_string(&self, amount: u64, truncate: bool) -> String {
		let exp = self.exponent();
		let a = format!("{}", amount);
		let len = a.len();
		let pos = len.saturating_sub(exp);
		let (characteristic, mantissa_prefix) = if pos > 0 {
			(&a[..(len - exp)], String::new())
		} else {
			("0", "0".repeat(exp - len))
		};
		let mut mantissa = &a[pos..];
		if truncate {
			let nzeroes = mantissa.chars().rev().take_while(|c| c == &'0').count();
			mantissa = &a[pos..(a.len().saturating_sub(nzeroes))];
			if mantissa.len() == 0 {
				mantissa = "0";
			}
		}
		format!("{}.{}{}", characteristic, mantissa_prefix, mantissa)
	}
pub fn amount_to_hr_string ( & self , amount : u64 , truncate : bool ) -> String { let exp = self . exponent ( ) ; let a = format ! ( " " amount ) ; let len = a . len ( ) ; let pos = len . saturating_sub ( exp ) ; let ( characteristic , mantissa_prefix ) = if pos > 0 { ( & a [ .. ( len - exp ) ] , String :: new ( ) ) } else { ( " " , " " . repeat ( exp - len ) ) } ; let mut mantissa = & a [ pos .. ] ; if truncate { let nzeroes = mantissa . chars ( ) . rev ( ) . take_while ( | c | c == & '0' ) . count ( ) ; mantissa = & a [ pos .. ( a . len ( ) . saturating_sub ( nzeroes ) ) ] ; if mantissa . len ( ) == 0 { mantissa = " " ; } } format ! ( " " characteristic mantissa_prefix mantissa ) }
Print amount in nano coins normally
Print amount in nano coins normally
&self
amount
u64
truncate
bool
&self
amount
u64
truncate
bool