Formatting a number to be zero-padded

|
int i = 3;
string padded = string.Format("{0:5D", i);
Gives a value of "00003" as the string called "padded" - that simple.

About this Entry

This page contains a single entry by Robert Wray published on February 9, 2009 4:10 PM.

Miscellanea 3 was the previous entry in this blog.

Miscellanea 4 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 5.04