首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

怎么生成0001,0002,0003.类似于foramt?等

2012-03-03 
如何生成0001,0002,0003.....类似于foramt?等如何生成0001,0002,0003.....类似于foramt?等如果整数位数不

如何生成0001,0002,0003.....类似于foramt?等
如何生成0001,0002,0003.....类似于foramt?等
如果整数位数不够就补0生成字符串,如果整数位数超出就将此整数直接生成字符串

1       ->   0001
2       ->   0002
3       ->   0003

....

12345       ->   12345

123456     ->   123456




[解决办法]
1.ToString( "D5 ") -> > 5位数字
1.ToString( "F5 ") -> > 5位小数
[解决办法]
If Len(Counts)=1 Then
Counts= "0000 "&Counts
End If
If Len(Counts)=2 Then
Counts= "000 "&Counts
End If
If Len(Counts)=3 Then
Counts= "00 "&Counts
End If
If Len(Counts)=4 Then
Counts= "0 "&Counts
End If

热点排行