更新时间:2023-12-01 10:53:10
***使用一个int,并使用ToString()
对其进行格式化.
Better use an int, and format it withToString()
.
Dim k As String = "00004"
Dim kValue As Integer = Integer.Parse(k) ' kValue = 4
kValue += 1 ' kValue = 5
k = kValue.ToString("00000") ' k = "00005"
Don''t.
将该值保留为整数,并在实际需要它而不是之前将其转换为字符串的情况.
Don''t.
Keep the value as an integer, and convert it to a string when you actually need it as a string, and not before.
Dim i As Integer = 4
Dim str As String = i.ToString("00000")
作为整数= 5
暗淡为string = cstr(a)
Dim a as integer = 5
Dim as string = cstr(a)