strfind
#1

If got a problema guys , i didn't understand what's happend if he returns -1 if he is not found

Returns The occurance of the substr, returns -1 if it's not found.
Reply
#2

Nothing happens?
Reply
#3

strfind returns the starting characters position of the substring found in string, strings start at bit 0,

Hello is
0 --> H
1 --> E
2 --> L
3 --> L
4 --> O

when you try to find "ll" in "hello", it would return 2. Now if we try to find "hi" in "hello", it returns -1 because it can't find it.

pawn Код:
if (strfind("hello", "hi", true) > -1) // it's bigger than -1, thus found
{
  // this is where the magic happens
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)