[フレーム]
Last Updated: February 25, 2016
·
449
· calibretto

Calculate the number of digits in an integer.

I can't remember where I got this from, but it's proved very useful a few times:

int digits = (score == 0) ? 1 : (int)log10(score) + 1;

AltStyle によって変換されたページ (->オリジナル) /