3 ms·
but this is not a appropriate place for that functionality.
by iovrthoughtthis 5y ago
but this is not a appropriate place for that functionality.
- kazinator 5y agoIt is entirely appropriate for a function which lexically analyzes a buffer in memory in order to match an integer to be able to tell you where that integer ends.
- iovrthoughtthis 5y agoi think thats a reasonable opinion in the context of say, language implementation. for the relatively simple case of parsing cli arguments i would want an equally simple api. "is this string a valid representation of a number?" and "what number does this string represent?" should be separate apis. even in language implementation, i'd want the identification of number tokens to be separate from the parsing of those number tokens. i would then have another, separate api for "where does the first number end in this string?" which would probably more likely be "return to me the next substring from this string that represents a number"