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.

Newcomers DBPro Corner / word finder

Author
Message
Kurai kaji
19
Years of Service
User Offline
Joined: 12th Jan 2005
Location: in my room
Posted: 9th Dec 2005 17:59
hi guys....
i need to find out how to finde one special word in a string.

if the string is "hallo world how are you"

how do i so finde out that "how" is in the string??

remember how it is to live...
or you will die..
Dark Version- The fire army.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 9th Dec 2005 18:53 Edited at: 9th Dec 2005 18:54
I believe you can use this:

pos = FIND SUB STRING$(source$, substring$)

It returns a negative number(or so it seems) if the substring isn't in source$.

Tempest - P2P UDP Multiplayer Plugin - 70%
Kurai kaji
19
Years of Service
User Offline
Joined: 12th Jan 2005
Location: in my room
Posted: 9th Dec 2005 19:12
well it prints the first letters position in the word..


i hope ther is a way to finde the word "how" and put it in another string. help pleas

remember how it is to live...
or you will die..
Dark Version- The fire army.
UFO
18
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 9th Dec 2005 22:33
TDK_Man has a function library that has a bunch of functions that do stuff with strings. I know he has a function that finds a word. Go here and download the String function library.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Dec 2005 22:58 Edited at: 9th Dec 2005 22:59
This is one of those "huh" messages. You want to find the word "how" from one string and put it in another string.

To find a word you must know the word.

If you already know the word there's no need to do anything special to put that string in another word. Benjamin told you all you need to know. Use that to determine if the word your looking for is in the string... if it returns a number less than 1 then it's not in the string.



I suggest also to change the string you looking in to highercase and the string your looking for to highercase. That way it won't fail the search if you look for words with mixes of highercase and lowercase letters.




Kurai kaji
19
Years of Service
User Offline
Joined: 12th Jan 2005
Location: in my room
Posted: 9th Dec 2005 23:03
ohh thanks^^

remember how it is to live...
or you will die..
Dark Version- The fire army.
Kurai kaji
19
Years of Service
User Offline
Joined: 12th Jan 2005
Location: in my room
Posted: 12th Dec 2005 12:23
well i got a new problem i can only finde one word
but i need to finde 2 or more word's now.. how do i do that??

remember how it is to live...
or you will die..
Dark Version- The fire army.
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 12th Dec 2005 14:51
do the same thing again with the other word?



Windows: 32 bit extension/graphical shell for a 16bit patch to an 8bit OS originally coded for a 4bit CPU, written by a 2bit company that can't stand 1bit of competition, now available in 64bits.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 12th Dec 2005 14:55
To find same word multiple times simply keep finding the word;



Boo!
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 12th Dec 2005 19:02
The set of functions that UFO mentioned includes one which takes a sentence and returns all the words in an array, along with the number of words found.

You can then use the number of words variable a simple For...Next loop to check if the word you are looking for was in the sentence.

TDK_Man

Kurai kaji
19
Years of Service
User Offline
Joined: 12th Jan 2005
Location: in my room
Posted: 13th Dec 2005 18:57
you misunderstood..
i need to finde tow defrent words on the same line like

"hallo world how are you"
so i need to finde "how" and "you"

so i use a input cormand so a player is free to print what he wants.
now i need to finde how many of some spical words he use

remember how it is to live...
or you will die..
Dark Version- The fire army.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Dec 2005 19:31
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 13th Dec 2005 19:33
Grog Grueslayer already gave you the code to find a word and Me! has already suggested doing exactly the same code but using a different search word.

We could post the code you need but if you can't even fathom out how to do such a simple task you will never learn. Should take you less than 30 seconds to get it working.

Boo!
Kurai kaji
19
Years of Service
User Offline
Joined: 12th Jan 2005
Location: in my room
Posted: 13th Dec 2005 20:22
no need to be angry..
i just don't get it..

so pleas fix this code :


i need to finde out if ther is, in the input are 1 or 2 of the spicel words and with of them ther are in use.
show me the code that can do that so i can see that im asking stupid

remember how it is to live...
or you will die..
Dark Version- The fire army.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 13th Dec 2005 23:23
We weren't being angry but actually trying to be helpful.

It would be pointless simply posting the code to do everything you want because it sounds like you haven't the foggiest idea how simple variables work.

You already know how to detect if a sentence contains a special word, so just repeat the command again using a different word and use a different variable to store result, for example you could use 'a' like now, to see if 'how' is in your sentence and 'b' to see if 'is' is in your sentence. Then you could say something like;

if a < 1 and b < 1 then neither word exists
if a > 0 and b < 1 then only word 1 exists
if a < 1 and b > 0 then only word 2 exists
else both words exist

Have a go at incorporating that.

Boo!
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Dec 2005 20:53
Quote: "print "ther a this/this words in the settens :"+unknown$"


I hope that if this is for someone else to play, you get a dictionary out before it's released!

TDK_Man

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 14th Dec 2005 22:13 Edited at: 14th Dec 2005 22:13
Oy!

Quote: "so pleas fix this code "


Just look at what input string you use and what string your looking at with the "find sub string$" command. You need to use the strings that have been defined instead of strings that don't exist yet (until you use them for the first time).


Login to post a reply

Server time is: 2024-09-24 11:23:03
Your offset time is: 2024-09-24 11:23:03