endl: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " {2,}\}\}" to " }}")
m (Some wiki formatting)
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command
{{RV|type=command


| arma3
|game1= arma3
|version1= 1.70


|1.70
|gr1= Strings


|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]]


| 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 "\r\n", which contains control characters rather than printable characters: 
|r1= [[String]] - line break
* <tt>[[hint]] [[str]] [[count]] "\r\n"; // 4</tt>
* <tt>[[hint]] [[str]] [[count]] [[endl]]; // 2</tt>
The line break works for [[diag_log]] and [[ctrlSetText]]. It doesn't work with the [[hint]] because [[hint]] interprets printable "\n" as line break instead. Alternatively one can use [[toString]] command to get other characters.


| '''endl'''
|x1= <sqf>diag_log ("line1" + endl + "line2");</sqf>


| [[String]] - line break
|x2= <sqf>
 
_ctrl = findDisplay 46 ctrlCreate ["RscTextMulti", -1];
|x1= <code>[[diag_log]] ("line1" + [[endl]] + "line2");</code>
_ctrl ctrlSetPosition [0,0,1,1];
|x2= <code>_ctrl = [[findDisplay]] 46 [[ctrlCreate]] ["RscTextMulti", -1];  
_ctrl ctrlCommit 0;
_ctrl [[ctrlSetPosition]] [0,0,1,1];  
_ctrl ctrlSetText format ["line1%1line2%1line3", endl];
_ctrl [[ctrlCommit]] 0;  
</sqf>
_ctrl [[ctrlSetText]] [[format]] ["line1%1line2%1line3", [[endl]]];</code>


| [[lineBreak]], [[str]], [[format]], [[toString]], [[joinString]], [[splitString]], [[toArray]]
|seealso= [[lineBreak]] [[str]] [[format]] [[toString]] [[joinString]] [[splitString]] [[toArray]]
}}
}}


[[Category:Scripting Commands|LINEBREAK]]
{{Note
{{GameCategory|arma3|Scripting Commands}}
|user= 7erra
 
|timestamp= 20200715115000
<!-- CONTINUE Notes -->
|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]].
<dl class="command_description">
}}
<dd class="notedate">Posted on July 15, 2020 - 11:50 (UTC)</dd>
<dt class="note">[[User:7erra|7erra]]</dt>
<dd class="note">
{{Inline code|[[toArray]] [[endl]]}} results in {{Inline code|[13, 10]}}. {{Inline code|[[toString]] [13, 10]}} is therefore equivalent (or at least very similar) to [[endl]].
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 16:52, 11 July 2022

Hover & click on the images for description

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:
hint str count "\r\n"; // 4 hint str count endl; // 2
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

Syntax:
endl
Return Value:
String - line break

Examples

Example 1:
diag_log ("line1" + endl + "line2");
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
7erra - c
Posted on Jul 15, 2020 - 11:50 (UTC)
toArray endl results in [13, 10]. toString [13, 10] is therefore equivalent (or at least very similar) to endl.