java - Processing a charArray - what happens here? -
while reading through questions here , trying understanding code came interesting question , me interesting solution jens-peter haack. see here: how implement independent cells in javafx? - don't understand lines of code. can please explain in detail happens here:
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': count = 10 * count + (c - '0');
unfortuneatly haven't found way ask author directly.
it's part of switch-case
statement. seems switch(c)
somewhere before code. means if c
character expressing digit (from '0'
'9'
), update count
: multiply 10
, add digit. subtracting '0'
necessary convert character (like '1'
) number 1
.
Comments
Post a Comment