C#数字前面如何补0
2021-06-11 03:05
标签:函数 code console adk bsp col rgs nbsp str PadLeft()函数:向左补齐 C#数字前面如何补0 标签:函数 code console adk bsp col rgs nbsp str 原文地址:https://www.cnblogs.com/cnwuchao/p/10586721.html
PadRight()函数:向右补齐 class Program
{
static void Main(string[] args)
{
int a = 3;
Console.WriteLine(a.ToString().PadLeft(3,‘0‘)); //向左补齐
Console.WriteLine(a.ToString().PadRight(3, ‘0‘)); //向右补齐
Console.ReadKey();
}
}