How to change 1 to 00001?

后端 未结 9 828
予麋鹿
予麋鹿 2021-01-03 23:59

I want to have numbers with a fixed digit count.

example: 00001, 00198, 48484

I can do like this:

    string value;
    if (number < 10)
          


        
9条回答
  •  隐瞒了意图╮
    2021-01-04 00:25

    int input_number = Convert.ToInt32(txtinput.Text);
    string number_value = input_number.ToString("00000");
    

    I hope that it will solve your problem. It worked well for me in my previous project. Test this code in your development. It should be worked properly without doubt.

提交回复
热议问题