colobot-data/help/cbot/R/string.txt

32 lines
1.5 KiB
Plaintext
Raw Normal View History

\b;Тип \c;string\n;
Используйте переменные этого типа для хранения строки, которая может состоять как из одного символа, так и из целого предложения.
Например:
\s;\c; "Привет!"
\s; "Это строка"
\s; "х"
\s; "" // пустая строка
\n;
Чтобы соединить две строки, используйте оператор \c;+\n; :
\s;\c; "Доброе утро," + " " + "сер"
Получится строка:
\s;\c; "Доброе утро, сер"
If you want to put a quotation mark (") or a backslash (\) in a string you must write¦:
\s;\c;"This is \"very\" important"
\n;which will result in the string \c; This is "very" important.
\s;\c;"%user%\\ant.txt"
\n;will result in \c;%user%\ant.txt
\n;
Following instructions can be used with strings¦:
\c;\l;strlen\u cbot\strlen; \n;Get string length
\c;\l;strleft\u cbot\strleft; \n;Extract left part
\c;\l;strright\u cbot\strright; \n;Extract right part
\c;\l;strmid\u cbot\strmid; \n;Extract center part
\c;\l;strfind\u cbot\strfind; \n;Find a substring.
\c;\l;strval\u cbot\strval; \n;Convert string to number
\c;\l;strupper\u cbot\strupper; \n;Convert to upper case
\c;\l;strlower\u cbot\strlower; \n;Convert to lower case
\t;Смотри также
\l;Программирование\u cbot;, \l;типы\u cbot\type; и \l;категории\u cbot\category;.