Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Counter with 5 digits

I want counter with 5 digits, for exaple: 00000, 00001, 00002.... I creating files with this command:

FileStream Fl = File.Create(@"C:\\U\\L\\Desktop\\" + "i" + (counter) + ".xml");

Definition of counter:

int counter;

My increment: counter++;

Have you any idea, how i could make 5 digits counter? Thanks for all ideas:)

like image 436
Kate Avatar asked Nov 28 '22 02:11

Kate


1 Answers

About custom numeric format strings

int value = 123;
Console.WriteLine(value.ToString("00000"));
// Displays 00123 
like image 67
Guru Stron Avatar answered Dec 05 '22 03:12

Guru Stron