{"name":"toArray","title":"toArray","type":"command","url":"https://community.bistudio.com/wiki/toArray","revid":377121,"updated":"2026-01-01T10:18:13Z","groups":["Arrays","HashMap","Strings"],"status":"ok","games":{"arma1":"1.09","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.09","arma3_since":"0.50","description":"Converts the supplied String into an Array of Numbers. The numbers in the created array are the decimal [Unicode](https://en.wikipedia.org/wiki/Unicode) representations of characters.\n\n> [!NOTE]\n> **Arma 3:** Since v2.04 this command can also handle HashMaps. See alternative syntax.","syntaxes":[{"syntax":"toArray string","params":[{"name":"string","type":"String","type_expr":"String"}],"returns":{"type":"Array of Numbers","type_expr":"Array<Number>"},"form":"unary","right":{"text":"string"}},{"syntax":"toArray hashMap","since":"arma3 2.04","params":[{"name":"hashMap","type":"HashMap","type_expr":"HashMap"}],"returns":{"type":"Array","type_expr":"Array","description":"array in format [[key, key, ...], [value, value, ...]]"},"form":"unary","right":{"text":"hashMap"}},{"syntax":"hashMap toArray splitArrays","since":"arma3 2.04","params":[{"name":"hashMap","type":"HashMap","type_expr":"HashMap"},{"name":"splitArrays","type":"Boolean","description":"see return value","type_expr":"Boolean"}],"returns":{"type":"Array","type_expr":"Array","description":"array in either one of the following formats:\n- splitArrays: true - `[[key1, key2, ...], [value1, value2, ...]]` - splitArrays: false - `[[key1, value1], [key2, value2], ...]` This is very inefficient since the engine has to create many small arrays","text":"Array - array in either one of the following formats:\n\n- splitArrays: true - `[[key1, key2, ...], [value1, value2, ...]]`\n- splitArrays: false - `[[key1, value1], [key2, value2], ...]` This is **very inefficient** since the engine has to create many small arrays"},"form":"binary","left":{"text":"hashMap"},"right":{"text":"splitArrays"}}],"examples":[{"code":["hint format [\"%1\", toArray \"AaŒ\"];// Returns \"[65,97,338]\""]},{"code":["toArray _hashMap params [\"_keys\", \"_values\"];"]},{"text":"```sqf\nprivate _hashmap = [\"cow\", \"cat\", \"chicken\"] createHashMapFromArray [10000, 20000, 20000];\n_hashmap toArray true;    // returns [[\"cow\", \"cat\", \"chicken\"], [10000, 20000, 20000]] - same as Syntax 2\n_hashmap toArray false;    // returns [[\"cow\", 10000], [\"cat\", 20000], [\"chicken\", 20000]]\n```","code":["private _hashmap = [\"cow\", \"cat\", \"chicken\"] createHashMapFromArray [10000, 20000, 20000];\n_hashmap toArray true;\t// returns [[\"cow\", \"cat\", \"chicken\"], [10000, 20000, 20000]] - same as Syntax 2\n_hashmap toArray false;\t// returns [[\"cow\", 10000], [\"cat\", 20000], [\"chicken\", 20000]]"]}],"see_also":["set","resize","reverse","select","in","find","toString","count","deleteAt","splitString","joinString","toUpperANSI"]}