toString: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) (Add 2.02 syntax) |
Lou Montana (talk | contribs) m (Add parseSimpleArray link) |
||
(31 intermediate revisions by the same user not shown) | |||
Line 20: | Line 20: | ||
|gr2= Arrays | |gr2= Arrays | ||
|descr= Converts the supplied [[Array]] of [[Number | |descr= Converts the supplied [[Array]] of [[Number]]s into a [[String]] through {{Link|https://en.wikipedia.org/wiki/Unicode}} characters representation conversion, or provided [[Code]] to [[compile|compilable]] [[String]]. | ||
|s1= [[toString]] array | |s1= [[toString]] array | ||
|p1= array: [[Array]] of [[Number]]s | |p1= array: [[Array]] of [[Number]]s | ||
{{Feature|important|If ''array'' contains non-number values, the following error might appear in .rpt file: {{hl|Bad conversion: scalar}}}} | {{Feature|important|If ''array'' contains non-number values, the following error might appear in .rpt file: {{hl|Bad conversion: scalar}}. See [[parseSimpleArray]] for multi-type array.}} | ||
|r1= [[String]] - {{ | |r1= [[String]] - {{Link|https://en.wikipedia.org/wiki/Unicode}} numbers converted to [[String]] of characters | ||
|s2= [[toString]] code | |s2= [[toString]] code | ||
Line 37: | Line 37: | ||
|r2= [[String]] - [[compile|compilable]] [[String]] from provided code | |r2= [[String]] - [[compile|compilable]] [[String]] from provided code | ||
|x1= < | |x1= <sqf>hint toString [65,97,338]; // returns "AaŒ"</sqf> | ||
|x2= < | |x2= <sqf>["test", "test"] joinString toString [12345] splitString toString [12345]; // ["test", "test"]</sqf> | ||
|x3= < | |x3= <sqf> | ||
private _compilableString = toString { hint "it works!" }; | |||
hint _compilableString; // hints ' hint "it works!" ' | |||
sleep 2; | |||
call compile _compilableString; // hints ' it works! ' | |||
</sqf> | |||
|seealso= | |seealso= [[parseSimpleArray]] [[set]] [[resize]] [[reverse]] [[select]] [[in]] [[find]] [[toArray]] [[forEach]] [[count]] [[deleteAt]] [[deleteRange]] [[append]] [[sort]] [[param]] [[params]] [[arrayIntersect]] [[splitString]] [[joinString]] [[toLower]] [[toUpper]] [[toFixed]] [[endl]] [[format]] [[formatText]] [[toLowerANSI]] [[toUpperANSI]], {{Link|http://www.utf8-chartable.de/|Unicode Character Table}} | ||
}} | }} | ||
Line 52: | Line 55: | ||
|timestamp= 20150210210500 | |timestamp= 20150210210500 | ||
|text= Tabs and new lines can be created with [[toString]] [9] and [[toString]] [10], respectively. Alternatively, a new line can also be created with [[toString]] [92,110] ("\n"). If you save these strings into a variable, they can be manipulated like any other string. For example, the following code will work just fine and return the expected output: | |text= Tabs and new lines can be created with [[toString]] [9] and [[toString]] [10], respectively. Alternatively, a new line can also be created with [[toString]] [92,110] ("\n"). If you save these strings into a variable, they can be manipulated like any other string. For example, the following code will work just fine and return the expected output: | ||
< | <sqf> | ||
_tab = toString [9]; | |||
for "_i" from 0 to 3 do | |||
{ | { | ||
_tab = _tab + ( | _tab = _tab + (toString [9]); | ||
}; | }; | ||
copyToClipboard format ["x%1x",tab]; | |||
</sqf> | |||
}} | }} | ||
Latest revision as of 12:24, 6 December 2023
Description
- Description:
- Converts the supplied Array of Numbers into a String through Unicode characters representation conversion, or provided Code to compilable String.
- Groups:
- StringsArrays
Syntax
- Syntax:
- toString array
- Parameters:
- array: Array of Numbers
- Return Value:
- String - Unicode numbers converted to String of characters
Alternative Syntax
- Syntax:
- toString code
- Parameters:
- code: Code
- Return Value:
- String - compilable String from provided code
Examples
- Example 1:
- Example 2:
- Example 3:
Additional Information
- See also:
- parseSimpleArray set resize reverse select in find toArray forEach count deleteAt deleteRange append sort param params arrayIntersect splitString joinString toLower toUpper toFixed endl format formatText toLowerANSI toUpperANSIUnicode Character Table
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
- Posted on Feb 10, 2015 - 21:05 (UTC)
- Tabs and new lines can be created with toString [9] and toString [10], respectively. Alternatively, a new line can also be created with toString [92,110] ("\n"). If you save these strings into a variable, they can be manipulated like any other string. For example, the following code will work just fine and return the expected output:
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.09
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Strings
- Command Group: Arrays