;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfIsAbbrev (strString, strAbbrev, intLength) intLength = Max (0, intLength) ; Negative number is forced to zero. If intLength == 0 Then Return StrSub (strString, 1, StrLen (strAbbrev)) == strAbbrev If intLength > StrLen (strAbbrev) Then Return @FALSE Return StrSub (strString, 1, intLength) == StrSub (strAbbrev, 1, intLength) ;.......................................................................................................................................... ; This UDF "udfIsAbbrev" returns @TRUE if strAbbrev is an abbreviation of strString otherwise @FALSE. ; If intLength == 0 then the UDF returns @TRUE if strAbbrev is equal to the first characters in strString, otherwise @FALSE. ; If intLength is specified, then strAbbrev must be at least intLength characters long or @FALSE will be returned. ;.......................................................................................................................................... ; Detlev Dalitz.20010729 ;.......................................................................................................................................... #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ; Test. ; Prepare parameter lists for use with WinBatch substitution feature. strIsAbbrev1 = '"WinBatch", "WinBat", -4' ; 1 = @TRUE, negative number is forced to zero. strIsAbbrev2 = '"WinBatch", "WinBat", 0 ' ; 1 = @TRUE strIsAbbrev3 = '"WinBatch", "WinBot", 0 ' ; 0 = @FALSE strIsAbbrev4 = '"WinBatch", "WinBot", 4 ' ; 1 = @TRUE strIsAbbrev5 = '"WinBatch", "Wi" , 3 ' ; 0 = @FALSE strIsAbbrev6 = '"WinBatch", "" , 0 ' ; 1 = @TRUE strIsAbbrev7 = '"WinBatch", "" , 1 ' ; 0 = @FALSE strResult = "" For intItem = 1 To 7 strParams = strIsAbbrev%intItem% blnResult%intItem% = udfIsAbbrev (%strParams%) strResult = StrCat (strResult, blnResult%intItem%) Next If (strResult == "1101010") Then Message ("Demo: udfIsAbbrev (strString, strAbbrev, intLength)", "Test ok.") Exit ;------------------------------------------------------------------------------------------------------------------------------------------