parseSimpleArray: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 9: | Line 9: | ||
|descr= Converts given, formatted as simple array, [[String]] into a valid [[Array]]. Simple array is array consisting of [[Number]]s, [[String]]s, [[Boolean]]s and [[Array]]s of all of the above. | |descr= Converts given, formatted as simple array, [[String]] into a valid [[Array]]. Simple array is array consisting of [[Number]]s, [[String]]s, [[Boolean]]s and [[Array]]s of all of the above. | ||
This command is almost '''4× faster''' than similar uncached [[call]] [[compile]] method. And because [[call]] [[compile]] is not required, it is also '''more secure''' and primarily intended for use with [[callExtension]] to parse the [[String]] output into [[Array]]. | This command is almost '''4× faster''' than similar uncached [[call]] [[compile]] method. And because [[call]] [[compile]] is not required, it is also '''more secure''' and primarily intended for use with [[callExtension]] to parse the [[String]] output into [[Array]]. | ||
Since {{arma3}} v1.96 the command | {{Feature|informative| | ||
Since {{arma3}} v1.96 the command tolerates extra spaces and supports single quotes. The only recognised keywords (case '''in'''sensitive) are: | |||
{{Columns|2| | |||
* {{hl|true}} - translates into [[true]] | * {{hl|true}} - translates into [[true]] | ||
* {{hl|false}} - translates into [[false]] | * {{hl|false}} - translates into [[false]] | ||
* {{hl|nil}} - translates into [[nil]] | * {{hl|nil}} - translates into [[nil]] | ||
* {{hl|null}} - translates into [[nil]] | * {{hl|null}} - translates into [[nil]] | ||
* {{hl|<null>}} - translates into [[nil]] | * {{hl|<null>}} - translates into [[nil]] (''not'' [[objNull]]) | ||
* {{hl|any}} - translates into [[nil]] | * {{hl|any}} - translates into [[nil]] | ||
}} | |||
}} | |||
|s1= [[parseSimpleArray]] stringArray | |s1= [[parseSimpleArray]] stringArray |
Latest revision as of 14:22, 29 March 2024
Description
- Description:
- Converts given, formatted as simple array, String into a valid Array. Simple array is array consisting of Numbers, Strings, Booleans and Arrays of all of the above. This command is almost 4× faster than similar uncached call compile method. And because call compile is not required, it is also more secure and primarily intended for use with callExtension to parse the String output into Array.
- Groups:
- StringsArrays
Syntax
- Syntax:
- parseSimpleArray stringArray
- Parameters:
- stringArray: String - string formatted as simple array
- Return Value:
- Array - valid array
Examples
- Example 1:
- Example 2:
- Example 3:
- _bool = true; _num = 123.45; _str = "ok"; _arr = [1, false, "cool"]; _res = parseSimpleArray format ["[%1,%2,%3,%4]", _bool, _num, str _str, str _arr]; // note how _bool and _num do not need str, however if used anyway, the result in this case would be identical hint str _res; // returns [true,123.45,"ok",[1,false,"cool"]]
Additional Information
- See also:
- set resize pushBack pushBackUnique select apply reverse count find in forEach deleteAt deleteRange append sort arrayIntersect callExtension
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