Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Extract Function:: Parses to find a given phrase in a given sentence.

Author
Message
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 29th Mar 2008 17:19


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.
Anonymous User
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location:
Posted: 29th Mar 2008 19:14
this would be cool for something like dynamic converstaions, type in what you want to talk about and if a certain word is in the list then you get a response.

???
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 29th Mar 2008 20:13
I was going to do a chatting robot that did stuff for you, like if you typed disk cleanup C:\ it would run disk clean up

Something along those lines. Also, it would be able to hold a real conversation.

But, hey, that's a ton of work

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.
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 8th Apr 2008 11:37
This is similar to the INSTR$ function (which is not in DBPro). I think that returned the position of the word. I suppose yours could use Left$ & right$ to replace all instances of that word with an equal amount of asterisks. e.g. censor("I like cheese, it tastes amazing","cheese") will return a string "I like ******, it tastes amazing"

The optomist's right, The pessimist's right.
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 11th Apr 2008 01:07
I could make a replace function if you like. It wont be too hard.

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.

Login to post a reply

Server time is: 2024-11-25 02:39:35
Your offset time is: 2024-11-25 02:39:35