3 ms·
Here's a readability tip for working with ASCII numbers: Treat adding and subtracting the ASCIIness as you would multiplying and dividing by a unit in physics.
by dlcarrier 5mo ago
Here's a readability tip for working with ASCII numbers: Treat adding and subtracting the ASCIIness as you would multiplying and dividing by a unit in physics. You can add '0' to convert a numeral to ASCII and subtract '0' to convert it back, and you can do direct comparisons between ASCII numerals.
if(characters[i] <= '9' && characters[i] >= '0')
{
ret = ret * 10 + characters[i] - '0';
}
- deleted 5mo ago[deleted]
- voidUpdate 5mo agoI was trying to remember how to do that, I forgot you can subtract '0', and was thinking that - 0 obviously wouldn't work