Skip to content

Instantly share code, notes, and snippets.

View TheSeanLavery's full-sized avatar

Sean Lavery TheSeanLavery

View GitHub Profile
@TheSeanLavery
TheSeanLavery / GetNumDigitsOfInt
Last active July 22, 2020 21:10
Get the number of digits in an Int
public static int GetNumDigitsOfInt(int v) {
if(v < 0) {
throw new ArgumentOutOfRangeException();
}
if(v == 0) {
return 1;
}
return (int)Math.Log10(v) +1;
}
public bool crash() { return crash(); }