Skip to main content

transform_decimal_and_space_to_ascii

Function transform_decimal_and_space_to_ascii 

Source
pub fn transform_decimal_and_space_to_ascii(s: &str) -> Cow<'_, str>
Expand description

Replace Unicode decimal digits with their ASCII equivalents and any Unicode whitespace with a plain space, so the byte-oriented numeric parsers can read them. Mirrors CPython’s _PyUnicode_TransformDecimalAndSpaceToASCII.

The result is always ASCII. Any other non-ASCII character cannot appear in a numeric literal, so it becomes a ? and the rest of the string is dropped: ? is rejected by every parser at every base, which leaves the caller — the one that knows the base and owns the original string — to raise the error.