Rolig Loon wrote:
Look for the first space?
integer idx = llSubStringIndex(message, " ");
string FirstWord = llGetSubString(message,0,idx);
One caveat about that bit of code. If your user decdies for whatever reason (including accidently) adds 1 or more spaces at the beginning, that routine will fail. The index of the first space will be zero so you will get a substring of zero to zero....which is nothing. You need to validate the entry if you have not already thought about it.
messge = llStringTrim(message, STRING_TRIM_HEAD);
//this will strip out all the white spaces at the beginning of the string
// then (and if you want to save a variable)
string firstWord = llGetSubString(message, 0, llSubstringIndex(message, " "));