Frazato
**
* Desenvolvido por João Frazato
* 20/11/2012
*
*
Function Main()
Teste()
Return nil
Function teste()
Close all
mProc :='NESTLE*SADIA*SUKITA'
lCondicaoE := .T.
use c:\frazato\produto
Index on Descricao to c:\temp\Rec10 ;
For (Jaf_OrdWildSeek(mProc,.T.))
Dbedit(00,0,24,79)
cLose all
return nil
//-----------------------------------------------------------------
Function JAF_OrdWildSeek(_mProc,lCondicaoE)
Local mProc := _mProc , x:= 0,nQtdTesteOk := 0
Local wOpcoes := {} , c := ''
Local lCondicaoE := _lCondicaoE
For i:= 1 to Len(mProc)
If Substr(mProc,i,1)=='*'
Aadd(wOpcoes,c)
c:=''
Else
c+= Substr(mProc,i,1)
Endif
Next
Aadd(wOpcoes,c)
For x:= 1 to Len(wOpcoes)
mProc := wOpcoes[x]
If Substr(Descricao,At(mProc,Descricao),Len(mProc))==mProc
nQtdTesteOk++
If lCondicaoE==.t.
Return .t.
Endif
endif
Next
Return Iif(nQtdTesteOk>=Len(wOpcoes),.t.,.f.)