proc main string sData ;String containing the data to search string sSearch ;String containing the possible strings we are looking for integer iRC ;Return code from function call sData = "Harry" sSearch = "Tom,Dick,Harry" iRC = mstrfind(sData, sSearch, ",", 3) ;Call function switch iRC case 0 usermsg "No match found!" endcase case 1 usermsg "Tom found!" endcase case 2 usermsg "Dick found!" endcase case 3 usermsg "Harry found!" endcase endswitch endproc func mstrfind : integer param string sData ;Passed string containing the data to search param string sSearch ;Passed string containing the list of strings we are looking for param string sTok ;Passed string containing the delimiter of sSearch param integer iNum ;Passed integer containing number of elements in sSearch string sTemp ;String for temporary processing integer iLoop ;Loop variable integer iResult = 0 ;Result to return, 1 indicates one of the possible strings was found ;0 indicates that none of the strings we were looking for were present for iLoop = 1 upto iNum strtok sTemp sSearch sTok ;Get first element to search for in sData if strfind sData sTemp ;If the substring was found... iResult = iLoop ;Set iResult to index value of matched element exitfor ;Exit the for loop endif endfor return iResult ;Return result to caller endfunc