MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / trailing_digits

Function trailing_digits

cranelift/reader/src/lexer.rs:99–106  ·  view source on GitHub ↗

Get the number of decimal digits at the end of `s`.

(s: &str)

Source from the content-addressed store, hash-verified

97
98/// Get the number of decimal digits at the end of `s`.
99fn 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.

Callers 1

split_entity_nameFunction · 0.85

Calls 2

as_bytesMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected