formatting - C# convert int to string with padding zeros? -


in c# have integer value need convereted string needs add zeros before:

for example:

int = 1; 

when convert string needs become 0001

i need know syntax in c#.

i.tostring().padleft(4, '0') - okay, doesn't cover cases
i.tostring("0000"); - explicit form
i.tostring("d4"); - short form format specifier


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -