Format string to a 3 digit number
Solution 1:
If you're just formatting a number, you can just provide the proper custom numeric format to make it a 3 digit string directly:
myString = 3.ToString("000");
Or, alternatively, use the standard D format string:
myString = 3.ToString("D3");
Solution 2:
string.Format("{0:000}", myString);
Solution 3:
It's called Padding:
myString.PadLeft(3, '0')