;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfItemLocateWild (strPattern, strItemList, strDelimiter, intStart, intStop) intCount = ItemCount (strItemList, strDelimiter) intStart = Min (Max (intStart, 1), intCount) intStop = Min (Max (intStop, 0), intCount) strLocateList = "" Switch intStop > 0 Case @TRUE ; Return list of similar items. For intElem = intStart To intStop strItem = ItemExtract (intElem, strItemList, strDelimiter) If StrIndexWild (strItem, strPattern, 1) == 1 Then strLocateList = ItemInsert (strItem, -1, strLocateList, strDelimiter) Next Return strLocateList Break Case @FALSE ; Return first similar item. For intElem = intStart To intCount strItem = ItemExtract (intElem, strItemList, strDelimiter) If StrIndexWild (strItem, strPattern, 1) == 1 Then Return strItem Next EndSwitch Return "" ;.......................................................................................................................................... ; This UDF udfItemLocateWild uses a given pattern string to search for similar items in a given itemlist, ; and returns an itemlist of similar items found. ; ; Parameters intStart and intStop define the area of items to be checked. ; If parameter intStop is set to zero, then only the first similar item will be returned. ; ; If no similar item has been found, then the functions returns an empty string. ; ; In the wildcard strPattern, "*" matches zero or more characters, and "?" matches any one character. ; ; 20110201.Detlev Dalitz. ;.......................................................................................................................................... #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------