Hi folks,
Currently there's an unexported function strconv.parseFloatPrefix (in strconv/atof.go). This function would be useful for certain types of parsing, for example, you could imagine code that parsed a string like (the somewhat-contrived) "float+float+float". Currently you'd either have to write a full scanner for floats and pass the result to ParseFloat, which means a lot of edge cases *and* doing work that ParseFloat will then do again. If parseFloatPrefix was exported as ParseFloatPrefix, you could simply skip over the number of bytes it returns.
I would use this in my GoAWK project, because the implicit conversion that AWK does when you ask for a number but the input is a string is allowed to be a prefix, like "1.5xyz" yields 1.5. I currently implement this with my own pre-scanner and then pass the result to ParseFloat. (I believe I used to use text/scanner, but it was rather heavy and slow.) I ran into this because I want to add hexadecimal floating point support, which is allowed by the POSIX AWK spec.
Thoughts? I'm happy to open an issue on this if folks think it has a reasonable chance of success, or at least some worthwhile discussion.
-Ben