Issue:
Need to see if one string is the beginning of another string
Solution:
Function DoesBegin(fullString As String, subString As String) As Integer
' start failure
DoesBegin= 0
' sanity check
If (fullString = "") Then
' return not found
Exit Function
End If
If (subString = "") Then
' return not found
Exit Function
End If
' compare two strings
If InStr(fullString, subString) = 1 Then
' does start with subString, return success
DoesBegin= 1
Else
' fullString does NOT contain subString
End If
End Function
Function DoesContain(fullString As String, subString As String) As Integer
' start failure
DoesContain = 0
' sanity check
If (fullString = "") Then
' return not found
Exit Function
End If
If (subString = "") Then
' return not found
Exit Function
End If
' compare two strings
If InStr(fullString, subString) > 0 Then
DoesContain = 1
Else
' fullString does NOT contain subString
End If
End Function
previous page
|