Get the number of decimal digits at the end of `s`.
(s: &str)
| 97 | |
| 98 | /// Get the number of decimal digits at the end of `s`. |
| 99 | fn trailing_digits(s: &str) -> usize { |
| 100 | // It's faster to iterate backwards over bytes, and we're only counting ASCII digits. |
| 101 | s.as_bytes() |
| 102 | .iter() |
| 103 | .rev() |
| 104 | .take_while(|&&b| b'0' <= b && b <= b'9') |
| 105 | .count() |
| 106 | } |
| 107 | |
| 108 | /// Pre-parse a supposed entity name by splitting it into two parts: A head of lowercase ASCII |
| 109 | /// letters and numeric tail. |
no test coverage detected