相关疑难解决方法(0)

向字符串添加零填充

如何在字符串中添加"0"填充,以便我的字符串长度始终为4?

If input "1", 3 padding is added = 0001
If input "25", 2 padding is added = 0025
If input "301", 1 padding is added = 0301
If input "4501", 0 padding is added = 4501
Run Code Online (Sandbox Code Playgroud)

c# string padding

148
推荐指数
5
解决办法
15万
查看次数

用前导零填充

如何用前导零填充我的整数变量.就像我有一个值为20的整数abc,但我希望它是'0000020'.

码:

quarterlyReportDataCMMS.QRTrailerRecord.FileRecordCount = Convert.ToInt32(refEligibleClaimants.Count);
Run Code Online (Sandbox Code Playgroud)

c#

74
推荐指数
5
解决办法
11万
查看次数

标签 统计

c# ×2

padding ×1

string ×1