VBScript函数出现错误。请帮忙?
当我运行它时,我在第一行公共函数上得到一个错误 我得到的是VBScript函数出现错误。请帮忙?,vbscript,Vbscript,当我运行它时,我在第一行公共函数上得到一个错误 我得到的是 “Microsoft VBScript编译错误:应为语句”您无法键入VBScript,因此: 公共函数BinarySearch(userNameString,switchPosition)作为布尔值,在vbscript中所有内容都是可变的,无需键入变量。 将返回值分配给函数名: BinarySearch=false 将函数命名为binarysearch,然后进行文本比较?谢谢,返回语句也会带来问题。如何返回值?请使用函数名BinaryS
“Microsoft VBScript编译错误:应为语句”您无法键入VBScript,因此:
公共函数BinarySearch(userNameString,switchPosition)作为布尔值,在vbscript中所有内容都是可变的,无需键入变量。 将返回值分配给函数名: BinarySearch=false
将函数命名为binarysearch,然后进行文本比较?谢谢,返回语句也会带来问题。如何返回值?请使用函数名
BinarySearch=False
Public Function BinarySearch(userNameString, switchPosition) As Boolean
If Right(LCase(userNameString), 8) = "lastname" Then
If Left(LCase(userNameString), 5) = "admin" Or Left(LCase(userNameString, 7) = "firstname" Then
If StrComp(switchIsOn(switchPosition), "1", vbTextCompare) = 0 Then
' Verify the user is admin lastname or firstname lastname and switch is on
Return True
Else
' Verify the user is admin lastname or firstname lastname and switch is off
Return False
End If
Else
' Users last name is lastname
Return False
End If
Else
' Not lastname
Return False
End If
End Function