How to: left justify numbers & determine number of digits in a number


#1

Hi Hops, here's how to make left justified numbers for your project so numbers like scores stay aligned to the corresponding labels even when numbers get really big. You need to know the number of digits in the number, so that's also shown.

The basic idea is straightforward. Offset the position of the number by:
11 x size/100 x (number of digits - 1)

Here's the code:

And an example:


#2

This is really cool!! I'm sure this will help a lot of people :D


#3

This is really cool, thank you for sharing!


#4

Coolness that's pretty cool thank you for that.