'_' groups binary/octal/hex every four digits; decimal and ',' every three.
(ty: u8, sep: u8)
| 302 | |
| 303 | // '_' groups binary/octal/hex every four digits; decimal and ',' every three. |
| 304 | fn group_size(ty: u8, sep: u8) -> usize { |
| 305 | if sep == b'_' && matches!(ty, b'b' | b'o' | b'x' | b'X') { 4 } else { 3 } |
| 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); |