Cdr*_*lak 3 c# string int zero-pad
我目前将整数转换为字符串以显示到屏幕,但希望保持4位数 - 即10 ="0010".从10的整数到字符串"0010"的最佳方法是什么?
这是在C#和.NET 4中.
干杯!
Zbi*_*iew 9
int num = 1; // pad with 0 up to 4 places string str = num.ToString("D4");
L.B*_*L.B 7
var str = 10.ToString("0000");
归档时间:
13 年 前
查看次数:
211 次
最近记录: