比如我有字符串"000222",那我要判断这个字符串前三位是否为零怎么个判断啊 》
用什么函数啊?

解决方案 »

  1.   

    if mid("000222",1,3)="000" then
       ... 
    else
       ...
    end if
      

  2.   

    Dim str As String
    Dim str_1 As String
    Dim msg As String
    str = "101222"
    For i = 1 To 3
        If Mid(Left(str, 3), i, 1) <> "0" Then
            MsgBox "第" & i & "不为0"
        End If
    Next
      

  3.   

    如果确定是可转换为数字的字符串,可先转成数字检验:
    strNO="00055443.025"
    msgbox "字串开头有" & len(strNO)-len(cstr(val(strNO))) & "个零"