如何在VB中判断一个字符串左边第一字符是否为"Z"

解决方案 »

  1.   

    Private Sub Command1_Click()
    s = "ZKOKOKOKOHHjkl"
    If Left(s, 1) = "Z" Then
    Print "yes"
    Else
    Print "no"
    End If
    End Sub
      

  2.   

    使用left(s,1),s是你的字符串,1是指从左边(left)取1个字符。同理还有right()等等
      

  3.   

    Private Sub Command1_Click()
        If Mid("zasdf", 1, 1) = "z" Then
             MsgBox "yes"
        Else
            MsgBox "no"
        End If
        
    End Sub
      

  4.   

    1.left函数
      if  Left(s, 1) = "Z" then
    2.MID函数
       if  mid(s, 1,1) = "Z" then