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

20 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

\b;Инструкция \c;strval\n;
Преобразует строку в число. Не путайте строку \c;"45"\n;, которая содержит в себе на самом деле два символа - \c;4\n; и \c;5\n;, и число \c;45\n;.
Примеры¦:
\s;\c; string s = "45"+"12"; // s содержит "4512"
\s; float n = 45 + 12; // n содержит 67
\n;
Синтаксис¦:
\s;\c;strval ( string );\n;
\n;
Примеры¦:
\s;\c; float n = strval("1.23"); // n станет 1.23
\s; float n = strval("12abc45"); // n станет 12
\s; float n = strval("abc"); // n станет 0
\s; float n = strval("100")+2; // n станет 102
\n;
\t;См. также
\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;strfind\u cbot\strfind;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n;
\l;Программирование\u cbot;, \l;типы\u cbot\type; и \l;категории\u cbot\category;.