MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / format_number

Function format_number

src/display.rs:58–68  ·  view source on GitHub ↗

Formats a number with comma separators (e.g. 243302 -> "243,302").

(n: u64)

Source from the content-addressed store, hash-verified

56
57/// Formats a number with comma separators (e.g. 243302 -> "243,302").
58pub fn format_number(n: u64) -> String {
59 let s = n.to_string();
60 let mut result = String::new();
61 for (i, ch) in s.chars().rev().enumerate() {
62 if i > 0 && i % 3 == 0 {
63 result.push(',');
64 }
65 result.push(ch);
66 }
67 result.chars().rev().collect()
68}
69
70/// Formats a single table cell with left-aligned label and right-aligned value.
71fn format_cell(label: &str, value: &str, width: usize) -> String {

Callers 2

compute_cell_widthFunction · 0.70
build_stats_rowsFunction · 0.70

Calls 2

pushMethod · 0.80
collectMethod · 0.80

Tested by

no test coverage detected