mob/verb/Chat(t as text)
How would I find the 1st word said in a sentence if I used this?
I have a general idea but I am not sure if it would work.
Code:
mob/verb/Chat(t as text) How would I find the 1st word said in a sentence if I used this? I have a general idea but I am not sure if it would work. |
I'm assuming findtext() grabs the position of the first needle searching from left to right. Return everything to the left of the first space found.
proc/first_word(t) |
ok so I ran into another problem. I was able to find the 1st word. But how do I remove it from the text?
|
In response to Dj dovis
|
|
Now that you know how to find the first Space in a text string, all you need to do is apply your knowledge of copytext() and copy all the text AFTER the Space instead of before it. That will only take a tiny modification of the moot code I provided.
|
Alri and then all I do is send the text after the space. Just needed a bit of thinking thanks.
|
In response to Dj dovis
|
|
Do essentially the same thing except the value returned from findtext() [either used directly or stored in a variable as Kaiochao showed] + 1 is used for the starting position:
Rest = copytext(..., findtext(...) + 1) |
First = copytext(..., 1, findtext(" ",...))