Function extract(sentence$, extraction$)
BeginExtraction=0
ExtractionLength=1
LowSentence$=lower$(sentence$)
LowExtraction$=lower$(extraction$)
If len(LowSentence$)=0 : exitfunction : EndIf
For x=1 to len(LowSentence$)
If mid$(LowSentence$,x)=mid$(LowExtraction$,1)
If mid$(LowSentence$,x-1)="" or mid$(LowSentence$,x-1)=" " or mid$(LowSentence$,x-1)="!" or mid$(LowSentence$,x-1)="@" or mid$(LowSentence$,x-1)="#" or mid$(LowSentence$,x-1)="$" or mid$(LowSentence$,x-1)="%" or mid$(LowSentence$,x-1)="^" or mid$(LowSentence$,x-1)="&" or mid$(LowSentence$,x-1)="*" or mid$(LowSentence$,x-1)="(" or mid$(LowSentence$,x-1)=")" or mid$(LowSentence$,x-1)="_" or mid$(LowSentence$,x-1)="-" or mid$(LowSentence$,x-1)="+" or mid$(LowSentence$,x-1)="=" or mid$(LowSentence$,x-1)="[" or mid$(LowSentence$,x-1)="{" or mid$(LowSentence$,x-1)="]" or mid$(LowSentence$,x-1)="}" or mid$(LowSentence$,x-1)=";" or mid$(LowSentence$,x-1)=":" or mid$(LowSentence$,x-1)="'" or mid$(LowSentence$,x-1)=chr$(34) or mid$(LowSentence$,x-1)="," or mid$(LowSentence$,x-1)="<" or mid$(LowSentence$,x-1)="." or mid$(LowSentence$,x-1)=">" or mid$(LowSentence$,x-1)="/" or mid$(LowSentence$,x-1)="?" or mid$(LowSentence$,x-1)="\" or mid$(LowSentence$,x-1)="|"
BeginExtraction=x
exit
EndIf
EndIf
next x
If BeginExtraction=0 : exitfunction : EndIf
ReturnValue=2
If len(LowExtraction$)>1
For x=1 to len(LowExtraction$)-1
If mid$(LowSentence$,BeginExtraction+x)=mid$(LowExtraction$,1+x)
ELSE
returnvalue=0
EndIf
inc ExtractionLength
next x
EndIf
If returnvalue=2
If ExtractionLength=len(LowExtraction$)
If mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))=" " or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="!" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="@" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="#" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="$" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="%" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="^" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="&" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="*" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="(" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))=")" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="_" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="-" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="+" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="=" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="[" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="{" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="]" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="}" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))=";" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))=":" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="'" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))=chr$(34) or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="," or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="<" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="." or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))=">" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="/" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="?" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="\" or mid$(LowSentence$,BeginExtraction+len(LowExtraction$))="|"
returnvalue=1
EndIf
EndIf
EndIf
EndFunction returnvalue
Returns 1 if the phrase was found, and 0 if it wasn't.
Example...
ReturnValue=Extract("I like cheese, it tastes amazing!","cheese")
The variable 'ReturnValue' would return 1 because "cheese" was found in the sentence.
Have fun. This could be used to filter out bad words in a chat system, etc.
3.11 We do not tolerate posts made for the purpose of putting down another forum member, group of members, religion, our company, our staff or any of our moderators, past or present.