pub fn amount_from_hr_string(&self, hr: &str) -> Result<u64, ErrorKind> {
		if hr.find(",").is_some() {
			return Err(ErrorKind::InvalidAmountString(hr.to_string()));
		}

		let exp = self.exponent();

		let (characteristic, mantissa) = match hr.find(".") {
			Some(pos) => {
				let (c, m) = hr.split_at(pos);
				(parse_characteristic(c)?, parse_mantissa(&m[1..], exp)?)
			}
			None => (parse_characteristic(hr)?, 0),
		};

		let amount = characteristic * 10u64.pow(exp as u32) + mantissa;
		if amount == 0 {
			return Err(ErrorKind::InvalidAmountString("zero amoount".to_string()));
		}

		Ok(amount)
	}
/// Convert string amount to Satoshi amount
Convert string amount to Satoshi amount
Convert string amount to Satoshi amount
pub fn amount_from_hr_string(&self, hr: &str) -> Result<u64, ErrorKind> {
		if hr.find(",").is_some() {
			return Err(ErrorKind::InvalidAmountString(hr.to_string()));
		}
		let exp = self.exponent();
		let (characteristic, mantissa) = match hr.find(".") {
			Some(pos) => {
				let (c, m) = hr.split_at(pos);
				(parse_characteristic(c)?, parse_mantissa(&m[1..], exp)?)
			}
			None => (parse_characteristic(hr)?, 0),
		};
		let amount = characteristic * 10u64.pow(exp as u32) + mantissa;
		if amount == 0 {
			return Err(ErrorKind::InvalidAmountString("zero amoount".to_string()));
		}
		Ok(amount)
	}
pub fn amount_from_hr_string ( & self , hr : & str ) -> Result < u64 , ErrorKind > { if hr . find ( " " ) . is_some ( ) { return Err ( ErrorKind :: InvalidAmountString ( hr . to_string ( ) ) ) ; } let exp = self . exponent ( ) ; let ( characteristic , mantissa ) = match hr . find ( " " ) { Some ( pos ) => { let ( c , m ) = hr . split_at ( pos ) ; ( parse_characteristic ( c ) ? , parse_mantissa ( & m [ 1 .. ] , exp ) ? ) } None => ( parse_characteristic ( hr ) ? , 0 ) , } ; let amount = characteristic * 10u64 . pow ( exp as u32 ) + mantissa ; if amount == 0 { return Err ( ErrorKind :: InvalidAmountString ( " " . to_string ( ) ) ) ; } Ok ( amount ) }
Convert string amount to Satoshi amount
Convert string amount to Satoshi amount
&self
hr
&str
&self
hr
&str