My name is Brock
My name is Brockaleana
if(strfind(string,"Brock",true)!=-1) {
print("Got ya");
}
|
Originally Posted by Jefff
Code:
if(strfind(string,"Brock",true)!=-1) {
print("Got ya");
}
|

|
Originally Posted by WackoX
Use the explode or split function by Denver, and split on space.
|
new str[128];
format(str, 128, "%s", text);
new start;
for(new letter; letter<strlen(str); letter++)
{
start = strfind(str, "Word", true); //Checking if word from list can be found in the message
if(start != -1) //If The word is found
{
if(letter == start)
{
// Do Something here
return 1; // return 0; if you dont want the text to be shown.
}
}
}
/**
* Finds a word in a string
* @param string The string to search
* @param word The word to search for
* @param ignorecase If the search is case insensitive
* @param pos The starting position for the search
* @return The position in the string of the begining of the word, or -1 if not found
*/
stock strfindword(const string[], const word[], bool:ignorecase=false, pos=0)
{
if(isnull(word)) return -1;
new wlen = strlen(word);
if(ispacked(string)) {
for(new i = strfind(string, word, ignorecase, pos); i != -1; i = strfind(string, word, ignorecase, ++i)) {
if((i == 0 || string{i-1} <= ' ') && string{i+wlen} <= ' ') {
return i;
}
}
} else {
for(new i = strfind(string, word, ignorecase, pos); i != -1; i = strfind(string, word, ignorecase, ++i)) {
if((i == 0 || string[i-1] <= ' ') && string[i+wlen] <= ' ') {
return i;
}
}
}
return -1;
}