下面是一个带有 switch 语句的示例函数,但是我很难理解一个函数如何等于提供的参数?
Function getnumber(value, method) As String
Dim i, j As Integer
Dim rtn As String
j = 0
Select Case method
Case 0:
getnumber = value
Case 1:
rtn = ""
For i = 1 To Len(value)
If IsNumeric(Mid(value, i, 1)) Then
j = j + 1
rtn = rtn & Mid(value, i, 1)
Else
If j > 3 Then Exit For
j = 0
rtn = ""
End If
Next
If rtn = "" Then getnumber = "" Else getnumber = rtn
Case Else:
MsgBox ("Invalid method in getnumber")
End Select
End Function
“getnumber = value”真的让我很困惑。其中getnumber是函数,value 是getnumber函数的参数
有任何想法吗?