String formatting
February 2, 2012
Something small but usefull is the String.Format function, with which you can format your numerical outputs:
using System; using System.Collections; ... // formatted float with three zero padded digits // in front of the "." and three digits after it. debugText += String.Format("H{0:000.000}\n", heading); // formatted int with formats for positive;negative;zero values debugText += String.Format("S{0:+000;-000; 000}\n", speed);
Categorised in: Game development, HowTo