string a = 1; if (a.Length<6) { for (int i = 0; i < (6-a.Length); i++) { a = a.Insert(0, "0"); }
} 这样最合理
第2个回答 推荐于2016-09-02
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string s = "00001"; int i = Int32.Parse(s); i++; string ss = i.ToString().PadLeft(5, '0'); Console.WriteLine(ss);