insert: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "Bool" to "Boolean")
m (Some wiki formatting)
Line 35: Line 35:
|r2= [[String]] - The new string
|r2= [[String]] - The new string


|s3= hashMap [[insert]] <nowiki>[[</nowiki>key1, value1], [key2, value2], ...] {{Since|arma3|2.04|y}}
|s3= hashMap [[insert]] [<nowiki/>[key1, value1], [key2, value2], ...]
 
|s3since= arma3 2.04


|p41= hashMap: [[HashMap]]
|p41= hashMap: [[HashMap]]
Line 45: Line 47:
|r3= [[Nothing]]
|r3= [[Nothing]]


|s4= hashMap [[insert]]  [splitArray, [KeysAndValues]] {{Since|arma3|2.04|y}}
|s4= hashMap [[insert]]  [splitArray, [keysAndValues]]
 
|s4since= arma3 2.04


|p61= hashMap: [[HashMap]]
|p61= hashMap: [[HashMap]]


|p62= splitArray: [[Boolean]] - See ''KeysAndValues''
|p62= splitArray: [[Boolean]] - determines ''keysAndValues'' format (see ''keysAndValues''<nowiki/>'s description)


|p63= KeysAndValues: [[Array]]
|p63= keysAndValues: [[Array]] - in format depending on ''splitArray''<nowiki/>'s value:
* If ''splitArray'' is [[true]] then in format {{ic|<nowiki>[</nowiki>[key1, key2, ...], [value1, value2, ...]]}}
* [[true]] - {{ic|[<nowiki/>[key1, key2, ...], [value1, value2, ...]]}}
* If ''splitArray'' is [[false]] then {{ic|<nowiki>[</nowiki>[key1, value1], [key2, value2], ...]}} Same as alt. syntax 2
* [[false]] - {{ic|[<nowiki/>[key1, value1], [key2, value2], ...]}} (same as {{HashLink|#Syntax 3}})


|r4= [[Nothing]]
|r4= [[Nothing]]

Revision as of 22:01, 10 August 2021

Hover & click on the images for description

Description

Description:
Inserts multiple values into Array/String/HashMap.
The String variant also supports forceUnicode.
Groups:
HashMapArraysStrings

Syntax 1

Syntax:
array insert [index, [value1, value2, ...], onlyIfUnique]
Parameters:
array : Array
index: Number - index at which the values will be inserted, -1 for append.
[value1, value2, ...]: Array of Anything - Values to insert at the specified index
onlyIfUnique: Boolean - Only insert if the value is unique in the array, like pushBackUnique
Return Value:
Nothing

Syntax 2

Syntax:
string insert [index, substring]
Parameters:
string : String
index: Number - index at which the values will be inserted, -1 for append.
substring: String - String to insert
Return Value:
String - The new string

Syntax 3

Syntax:
hashMap insert [[key1, value1], [key2, value2], ...]
Parameters:
hashMap: HashMap
key: HashMapKey
value: Anything
Return Value:
Nothing

Syntax 4

Syntax:
hashMap insert [splitArray, [keysAndValues]]
Parameters:
hashMap: HashMap
splitArray: Boolean - determines keysAndValues format (see keysAndValues's description)
keysAndValues: Array - in format depending on splitArray's value:
  • true - [[key1, key2, ...], [value1, value2, ...]]
  • false - [[key1, value1], [key2, value2], ...] (same as Syntax 3)
Return Value:
Nothing

Examples

Example 1:
"Test" insert [0, "Radio"]; // Returns "RadioTest"

Additional Information

See also:
HashMap

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