查看: 31  |  回复: 0
VB6 检查前面是否一样的子程序 f_chkLeft(strL As String, strC As String)
楼主
发表于 4月24日 15:36

新建From1(窗体),新建Command1(按钮CommandButton),代码:

Private Function f_chkLeft(strL As String, strC As String)
    If Left(strL, Len(strC)) = strC Then
        f_chkLeft = True
    Else
        f_chkLeft =  False
    End If
End Function

Private Sub Command1_Click()
    Dim strL As String
    strL = "hello"
    MsgBox f_chkLeft(strL, "he")
End Sub

运行结果:

True

如果需要判断大小写,请先整理。

您需要登录后才可以回帖 登录 | 立即注册
【本版规则】请勿发表违反国家法律的内容,否则会被冻结账号和删贴。
用户名: 立即注册
密码:
2020-2024 MaNongKu.com