VB循环逐个截取字符串,VB循环截取字符串,VB逐个截取字符串,VB截取字符串,VB截取字符,VB截取,VB循环逐位截取字符串,VB逐位截取字符串,VB逐位截取,VB逐位。

VB循环逐个截取字符串,VB循环逐位截取字符串:

Dim Str  As String, I, T, Tmp
Str = "0123456789"                                                              '要截取的字符串
T = 2                                                                           '每次截取位数
Tmp = Len(Str) / T                                                              '截取次数
If InStr(Tmp, ".") > 0 Then Tmp = Int(Tmp) + 1                                  '取整数
For I = 1 To Tmp                                                                '循环逐个截取
    MsgBox Mid(Str, (I - 1) * T + 1, T)
Next

VB循环逐个/逐位截取字符串2:

JQ:
DoEvents '转让控制权防止假死
If Len(x) >= 2 Then MsgBox Left$(x, 2): x = Mid(x, 2 + 1): GoTo JQ '每次截取两位
If x <> "" Then MsgBox x: x = "" '剩余的不足两位