string num=12num.PadLeft(4, '0'); //结果为为 '0012' 看字符串长度是否满足4位,不满足则在字符串左边以"0"补足 转载于:https://www.cnblogs.com/shy1766IT/p/5184937.html