Code::Tyr wrote:
Hello. I have a simple problem and need help. I am developing a simple
file system that stores info based on folder names. Now, I only have
one problem. How do i format (int i = 2) into a string like "00002"
instead of the defualt "2"?
private static string AppendZerosBeginning(int input, int length)
{
return input.ToString().PadLeft(length, Convert.ToChar("0"));
}
If the numeric values are coming out of SQL Server, you can also use
the REPLICATE keyword in your select statement to pad the int with
leading zeros:
http://sqlblogcasts.com/blogs/tonyro...05/29/765.aspx