
Function GetVal(str As String, B As Boolean) As String
Dim i0 As Long, i1 As Long
Dim s As String
Dim i As Long
s = ""
Select Case B
Case -1
For i = 1 To Len(str)
If Asc(Mid(str, i, 1)) < Asc(0) Or Asc(Mid(str, i, 1)) > Asc(9) Then
s = s & Mid(str, i, 1)
Else
If i > 1 And i < Len(str) Then
If Right(s, 1) <> ";" Then
s = s & ";"
End If
End If
End If
Next
Case 0
For i = 1 To Len(str)
If Asc(Mid(str, i, 1)) >= Asc(0) And Asc(Mid(str, i, 1)) <= Asc(9) Then
s = s & Mid(str, i, 1)
Else
If i > 1 And i < Len(str) Then
If Right(s, 1) <> ";" Then
s = s & ";"
End If
End If
End If
Next
End Select
If Left(s, 1) = ";" Then
s = Mid(s, 2)
End If
If Right(s, 1) = ";" Then
s = Mid(s, 1, Len(s) - 1)
End If
GetVal = s
End Function
点击下载此附件