(digits: &str, group: usize, sep: u8)
| 306 | } |
| 307 | |
| 308 | fn add_grouped(digits: &str, group: usize, sep: u8) -> String { |
| 309 | let mut out = String::with_capacity(digits.len() + digits.len() / group); |
| 310 | let chars: alloc::vec::Vec<char> = digits.chars().collect(); |
| 311 | for (i, &c) in chars.iter().enumerate() { |
| 312 | if i > 0 && (chars.len() - i).is_multiple_of(group) { out.push(sep as char); } |
| 313 | out.push(c); |
| 314 | } |
| 315 | out |
| 316 | } |
| 317 | |
| 318 | fn add_thousands_float(s: &str, sep: u8) -> String { |
| 319 | /* Insert separators only in the integer portion (before `.` / `e`). */ |
no test coverage detected