home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 13
/
CD_ASCQ_13_0494.iso
/
maj
/
419
/
forcemat.bas
< prev
next >
Wrap
BASIC Source File
|
1994-03-13
|
1KB
|
51 lines
' +----------------------------------------------------------------------+
' | |
' | PBClone Copyright (c) 1990-1994 Thomas G. Hanlin III |
' | |
' +----------------------------------------------------------------------+
DECLARE SUB StripChar (St$, Ch$, StLen%)
FUNCTION ForceMatch$(Pattern$, SourceFile$)
a$ = Pattern$
GOSUB Regularize
Pat$ = a$
a$ = SourceFile$
GOSUB Regularize
Src$ = a$
FOR tmp% = 1 TO 12
IF MID$(Pat$, tmp%, 1) = "?" THEN
Result$ = Result$ + MID$(Src$, tmp%, 1)
ELSE
Result$ = Result$ + MID$(Pat$, tmp%, 1)
END IF
NEXT
StripChar Result$, " ", tmp%
ForceMatch$ = LEFT$(Result$, tmp%)
EXIT FUNCTION
Regularize:
t% = INSTR(a$, ".")
IF t% THEN
l$ = LEFT$(LEFT$(a$, t% - 1), 8)
r$ = LEFT$(MID$(a$, t% + 1), 3)
ELSE
l$ = LEFT$(a$, 8)
r$ = ""
END IF
t% = INSTR(l$, "*")
IF t% THEN
l$ = LEFT$(l$, t% - 1) + STRING$(9 - t%, "?")
ELSE
l$ = LEFT$(l$ + SPACE$(8), 8)
END IF
t% = INSTR(r$, "*")
IF t% THEN
r$ = LEFT$(r$, t% - 1) + STRING$(4 - t%, "?")
ELSE
r$ = LEFT$(r$ + SPACE$(3), 3)
END IF
a$ = l$ + "." + r$
RETURN
END FUNCTION