Hi,
I'm trying to create a leaderboard with 3 "columns": standing, name, and score. Ideally, the standing appears first and is left justified, the name of the player with that standing is exactly 3 uniform-width spaces from the left (also left-justified), and then the score is right justified.
I am attempting to use string.format to do this, but even though I am setting the character widths of each column within string.format, shorter width characters (like "1") seem to be throwing the entire thing off. Could anyone take a look at my results, and then my code below and let me know if there is anything I can tweak to get the desired effect.
Thanks!
Code:
int counter = 1;
foreach (float height in top5)
{
label.text +=
string.Format("{0, -5}{1, -10}{2, 9}", counter.ToString()
+ ". ", "ME: ", string.Format("{0:00.00}", height)) + " m\n";
counter++;
}