Skip to content

Commit 21c5df9

Browse files
committed
Some small improvements
1 parent 23ae211 commit 21c5df9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/ark/src/data_explorer/format.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,13 @@ fn apply_thousands_sep(x: String, sep: Option<String>) -> String {
363363
// the string must have already been processed to include the e+ in positive values
364364
fn pad_exponent(x: String) -> String {
365365
// find the exponent position
366-
let e_pos = x.find('e').unwrap();
366+
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)
367373
if (e_pos + 1 + 2) < x.len() {
368374
return x; // the exponent already have 2 digits
369375
}

0 commit comments

Comments
 (0)