2024-01-07 22:24:37 +01:00
|
|
|
use numfmt::{Formatter, Precision};
|
|
|
|
|
|
|
|
pub fn format_frequency(freq: f64) -> String {
|
|
|
|
let mut formatter = Formatter::new()
|
|
|
|
.separator(' ')
|
|
|
|
.unwrap()
|
|
|
|
.precision(Precision::Decimals(0));
|
|
|
|
|
|
|
|
formatter.fmt2(freq).to_owned()
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn format_frequency_mhz(freq: f64) -> String {
|
|
|
|
let mut formatter = Formatter::new()
|
|
|
|
.separator(' ')
|
|
|
|
.unwrap()
|
|
|
|
.suffix(" Hz")
|
|
|
|
.unwrap()
|
|
|
|
.precision(Precision::Decimals(3));
|
|
|
|
|
|
|
|
formatter.fmt2(freq).to_owned()
|
2023-12-24 23:06:03 +01:00
|
|
|
}
|