How do I parse a float from a string that might contain left-over characters without doing manual parsing?
问题 How do I parse a float from a string that may contain left-over characters, and figure out where it ends, without doing manual parsing (e.g. parseFloat() in JS)? An example would be the string "2e-1!" . I want to evaluate the next float from the string such that I can split this string into "2e-1" and "!" (for example, if I wanted to implement a calculator.) How would I do this without writing a parser to see where the float ends, taking that as an &str , and then using .parse() ? I am aware