C#数字前面如何补0
2021-06-11 03:05
阅读:400
标签:函数 code console adk bsp col rgs nbsp str
PadLeft()函数:向左补齐
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(); } }
C#数字前面如何补0
标签:函数 code console adk bsp col rgs nbsp str
原文地址:https://www.cnblogs.com/cnwuchao/p/10586721.html
评论
亲,登录后才可以留言!