************************
'Function function: Return one of the selected values based on the true or false condition
'Parameter: blnCondition: condition variable, varResultTrue: return value when the condition is true, varResultFalse: return value when the condition is false
FunctionIIF(blnCondition,varResultTrue,varResultFalse)
IfCBool(blnCondition)Then
IIF=varResultTrue
Else
IIF=varResultFalse
EndIf
EndFunction
'*********************
'Function function: determines whether a string element is in the given enum
'Article: sEle: string to be judged, sArray: Specify enum
'For example: determine whether the image file is based on the extension: InArray(strFileExt,"jpg,gif,bmp,png")
FunctionInArray(sEle,sArray)
DimaArray
Dimi
aArray=Split(sArray,",")
Fori=0ToUBound(aArray)
IfTrim(sEle)=Trim(aArray(i))Then
InArray=True
ExitFunction
EndIf
Next
InArray=False
EndFunction
'*********************
'Function function: determine whether a string conforms to a regular expression
'Arguments:strString:String,strPattern:regular expression
FunctiondoReTest(strString,strPattern)
DimoRE
SetoRE=NewRegExp
oRE.Pattern=strPattern
oRE.IgnoreCase=True
doReTest=oRE.Test(strString)
SetoRE=Nothing
EndFunction
'*********************
'Function function: regular extraction
'Arguments: string: string, patrn: regular expression
'Return: Comma-segment of result array
FunctiondoReExec(strng,patrn)
DimregEx,Match,Matches,RetStr' creates variables.
SetregEx=NewRegExp' creates a regular expression.
regEx.Pattern=patrn'Set mode.
regEx.IgnoreCase=True' is set to case insensitive.
regEx.Global=True' setting applies globally.
SetMatches=regEx.Execute(strng)' performs the search.