We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 98f98bb commit f6dbfa4Copy full SHA for f6dbfa4
crates/ark/src/data_explorer/format.rs
@@ -363,7 +363,13 @@ fn apply_thousands_sep(x: String, sep: Option<String>) -> String {
363
// the string must have already been processed to include the e+ in positive values
364
fn pad_exponent(x: String) -> String {
365
// find the exponent position
366
- let e_pos = x.find('e').unwrap();
+ let e_pos = match x.find('e') {
367
+ Some(v) => v,
368
+ None => return x, // if no e is found, return the string as is
369
+ };
370
+
371
+ // "1e-12" the e_pos (1) + 3 is < x.len() (5)
372
+ // "1e-1" the e_pos (1) + 3 is == x.len() (4)
373
if (e_pos + 1 + 2) < x.len() {
374
return x; // the exponent already have 2 digits
375
}
0 commit comments