需求:将0输出为000,99输出为099 c# Console.WriteLine(0.ToString("000")); Console.WriteLine(99.ToString("000")); go fmt.Printf("%03d", 0) fmt.Printf("%03d", 99) 运行效果: