Author Topic: Retreiving All the Words In a String  (Read 467 times)

I have 3 questions.

1. How do I add something to a comma list?
2. How do I remove something from a comma list?
3. How do I read all the data inside a comma list?


EDIT: Forget the commas. I can do with spaces. But how do I retreive all the words that are in one string? I don't understand how the getWords() function works...
« Last Edit: May 14, 2009, 07:21:09 PM by Club559 »

Try a string replace from , to ;s or tabs, then use getfield or gettoken (I think?)

EDIT: Forget the commas. I can do with spaces. But how do I retreive all the words that are in one string? I don't understand how the getWords() function works...
getWord(%string,0) gets the first index (0) word in a string. So index 0 is the first word, 1 the second etc. getWordCount(%string) returns the amount of words in a string. So something like getWordCount("I like to eat fish") will return 5. getWord("I like to eat fish",2) will return "to".
To get all the words in a list, just do a for loop using getWordCount as the conditional (something like: for(%i=0;%i<getWordCount(%string);%i++)) you can also look in RTB (server control I believe) which has some neat word list functions you could use.
« Last Edit: May 14, 2009, 07:40:10 PM by Destiny/Zack0Wack0 »