FindWildcard

Top  Previous  Next

Sub FindWildcard($source As String, $wildcard As String, ByRef $startPos As Integer, ByRef $length As Integer) As Boolean

 

Searches in $source for the first occurrence of $wildcard. $wildcard is a Wildcard expression with a start text, an asterisk and an end text with the syntax:

 

StartText*EndText

 

FindWildcard is case-insensitive. The first character in $source has the position 1. If $wildcard is found, FindWildcard returns TRUE.

 

Parameters

 

$source ... String expression sought.
$wildcard ... Wildcard expression being searched (StartText*EndText).
$startPos ... Index of first occurrence.
$length ... Length of found String.

 

Example:

Dim $s, $iStart, $iLen

 

$s = "a number or a text"

If FindWildcard($s, "or*xt", $iStart, $iLen) Then

   ' returns iStart = 10, iLen = 9

End If