formular lesen (binär) und openspec für codex
This commit is contained in:
@@ -59,7 +59,9 @@ pub struct Waehrung {
|
||||
|
||||
impl Default for Waehrung {
|
||||
fn default() -> Self {
|
||||
Waehrung { zeichen: "$".into() }
|
||||
Waehrung {
|
||||
zeichen: "$".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +218,9 @@ fn zahl_formatieren(f: &NumFeld, wert: f64, waehrung: &Waehrung) -> String {
|
||||
let b = gerundet - gerundet.trunc();
|
||||
let s = format!("{:.*}", f.nach, b);
|
||||
// "0.25" → "25"
|
||||
s.split_once('.').map(|(_, r)| r.to_string()).unwrap_or_default()
|
||||
s.split_once('.')
|
||||
.map(|(_, r)| r.to_string())
|
||||
.unwrap_or_default()
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
@@ -231,11 +235,23 @@ fn zahl_formatieren(f: &NumFeld, wert: f64, waehrung: &Waehrung) -> String {
|
||||
// neben dem Zahlenfeld, nicht darin. Ohne Vorzeichenangabe teilt sich ein
|
||||
// `-` die Ziffernstellen.
|
||||
let (vorz_vorn, vorz_hinten, minus_im_feld) = if f.plus_vorn {
|
||||
(if negativ { "-" } else { "+" }.to_string(), String::new(), false)
|
||||
(
|
||||
if negativ { "-" } else { "+" }.to_string(),
|
||||
String::new(),
|
||||
false,
|
||||
)
|
||||
} else if f.plus_hinten {
|
||||
(String::new(), if negativ { "-" } else { "+" }.to_string(), false)
|
||||
(
|
||||
String::new(),
|
||||
if negativ { "-" } else { "+" }.to_string(),
|
||||
false,
|
||||
)
|
||||
} else if f.minus_hinten {
|
||||
(String::new(), if negativ { "-" } else { " " }.to_string(), false)
|
||||
(
|
||||
String::new(),
|
||||
if negativ { "-" } else { " " }.to_string(),
|
||||
false,
|
||||
)
|
||||
} else {
|
||||
(String::new(), String::new(), negativ)
|
||||
};
|
||||
@@ -358,7 +374,7 @@ pub fn using(fmt: &str, werte: &[Value], waehrung: &Waehrung) -> Result<String,
|
||||
let mut out = String::new();
|
||||
let mut i = 0usize; // Index im Teile-Vektor
|
||||
let mut w = 0usize; // Index im Wertevektor
|
||||
// Schutz gegen Endlosläufe bei Formaten ohne Fortschritt.
|
||||
// Schutz gegen Endlosläufe bei Formaten ohne Fortschritt.
|
||||
let mut runden = 0usize;
|
||||
|
||||
while w < werte.len() {
|
||||
|
||||
Reference in New Issue
Block a user