colobot-data/help/D/cbot/strfind.txt

21 lines
895 B
Plaintext
Raw Normal View History

\b;Instruction \c;strfind\n;
Find a substring in a string and returns the position of the first substring found or \l;nan\u cbot\nan; if the substring has not been found.
Syntax¦:
\s;\c;strfind ( string, sub );\n;
\t;string: \c;\l;string\u cbot\string;\n;
String we are searching in.
\t;sub: \c;\l;string\u cbot\string;\n;
Substring we are searching for.
Examples¦:
\s;\c; int pos = strfind("abcdef", "ab"); // pos will be 0
\s; int pos = strfind("abcdef", "de"); // pos will be 3
\s; int pos = strfind("abcdef", "xy"); // pos will be \l;nan\u cbot\nan;
\n;
\t;See also
\c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.