endl: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "</dd> </dl>" to "</dd> </dl>") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| arma3 | |game1= arma3 | ||
|version1= 1.70 | |||
| | |gr1= Strings | ||
| | |descr= Creates a string containing a line break, similar to [[lineBreak]] for [[text]]. The name is inspired by c++ std::endl ('''end''' '''l'''ine). | ||
The command returns {{hl|"\r\n"}}, which contains control characters rather than printable characters: | |||
<sqf> | |||
hint str count "\r\n"; // 4 | |||
hint str count endl; // 2 | |||
</sqf> | |||
The line break works for [[diag_log]] and [[ctrlSetText]]. | |||
It does not work with the [[hint]] because [[hint]] interprets printable "\n" as line break instead. | |||
Alternatively one can use [[toString]] command to get other characters. | |||
| | |s1= [[endl]] | ||
| | |r1= [[String]] - line break | ||
| | |x1= <sqf>diag_log ("line1" + endl + "line2");</sqf> | ||
| | |x2= <sqf> | ||
_ctrl = findDisplay 46 ctrlCreate ["RscTextMulti", -1]; | |||
_ctrl | _ctrl ctrlSetPosition [0,0,1,1]; | ||
_ctrl | _ctrl ctrlCommit 0; | ||
_ctrl | _ctrl ctrlSetText format ["line1%1line2%1line3", endl]; | ||
</sqf> | |||
|seealso= [[lineBreak]] | |seealso= [[lineBreak]] [[str]] [[format]] [[toString]] [[joinString]] [[splitString]] [[toArray]] | ||
}} | }} | ||
{{Note | |||
|user= 7erra | |||
|timestamp= 20200715115000 | |||
< | |text= <sqf inline>toArray endl</sqf> results in <sqf inline>[13, 10]</sqf>. <sqf inline>toString [13, 10]</sqf> is therefore equivalent (or at least very similar) to [[endl]]. | ||
< | }} | ||
< | |||
Latest revision as of 15:52, 11 July 2022
Description
- Description:
- Creates a string containing a line break, similar to lineBreak for text. The name is inspired by c++ std::endl (end line).
The command returns "
\r \n", which contains control characters rather than printable characters: The line break works for diag_log and ctrlSetText. It does not work with the hint because hint interprets printable "\n" as line break instead. Alternatively one can use toString command to get other characters. - Groups:
- Strings
Syntax
Examples
- Example 1:
- Example 2:
- _ctrl = findDisplay 46 ctrlCreate ["RscTextMulti", -1]; _ctrl ctrlSetPosition [0,0,1,1]; _ctrl ctrlCommit 0; _ctrl ctrlSetText format ["line1%1line2%1line3", endl];
Additional Information
- See also:
- lineBreak str format toString joinString splitString toArray
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note