切開、轉數字、加一、接回去
Module VBModule
Sub Main()
dim i as Integer
dim s as string = "IAT08052"
Console.WriteLine(s)
for i = 1 to 10
s = left(s, 4) & Convert.toInt32(right(s,4))+1
Console.WriteLine(s)
next i
End Sub
End Module
好久沒用VB了...土法鍊鋼提供您參考
Function PadDigits(val, digits,preset)
PadDigits = preset & Right(String(digits,"0") & val, digits)
End Function
For i = 8052 To 8055
wsh.echo PadDigits(i, 5,"IAT")
Next
public class compiler
shared function Main as integer
Dim testString As String = "IAT08052"
Dim subString As String
Dim i As Integer
for i = 1 to 3
subString = Left(testString, 3) & Right(Str$(100000+i+Val(Right(testString, 5))),5)
Console.WriteLine (subString)
next i
return 0
End function
end class
https://dotnetfiddle.net/AlTGgH
dim newid as string
for i = 0 to 1000
newid = "IAT" & (8052+i).ToString().PadLeft(5,"0")
console.WriteLine(newid)
next i