Skip to main content

strip_digit_separators

Function strip_digit_separators 

Source
pub fn strip_digit_separators(text: &str) -> String
Expand description

Strip Rust-style _ digit separators when well-formed (digits and at most one ., separators only between digits, never leading, trailing, or doubled, with an optional leading +/- sign passing through for signed domains); otherwise return the text untouched so the caller’s own parse decides. The single rule behind every string-to-number coercion (INT validation, assertion operands, byte counts), so 1_000_000 and -1_000 read identically everywhere while 1__0 and 1_ never silently become numbers. Unsigned callers still reject - at parse time; + parses like every other Rust-parsed number in the DSL.