{"name":"splitString","title":"splitString","type":"command","url":"https://community.bistudio.com/wiki/splitString","revid":377128,"updated":"2026-01-01T10:23:07Z","groups":["Strings"],"status":"ok","games":{"arma3":"1.50"},"since":"arma3 1.50","arma3_since":"1.50","description":"Splits the provided **ANSI** string into an array of tokens according to given delimiters.\n\n> [!NOTE]\n> For Unicode support, see forceUnicode.","syntaxes":[{"syntax":"str splitString delimiters","params":[{"name":"str","type":"String","description":"the string to split","type_expr":"String"},{"name":"delimiters","type":"String","description":"one or more characters, each used as a separate delimiter; if empty, *str* is split by each character","type_expr":"String"}],"returns":{"type":"Array of Strings","type_expr":"Array<String>"},"form":"binary","left":{"text":"str"},"right":{"text":"delimiters"}}],"examples":[{"code":["_str = \"- This, is a sample string.\" splitString \"-,. \"; // [\"This\",\"is\",\"a\",\"sample\",\"string\"]\n_str joinString \"#\"; // \"This#is#a#sample#string\""]},{"code":["\"\\A3\\ui_f\\data\\map\\vehicleicons\\iconLogic_ca.paa\" splitString \"\\.\"; // [\"A3\",\"ui_f\",\"data\",\"map\",\"vehicleicons\",\"iconLogic_ca\",\"paa\"]"]},{"code":["\"1:2:3\" splitString \":\"; // [\"1\",\"2\",\"3\"]"]},{"code":["\"Japa is the best!\" splitString \"\" joinString \" \"; // \"J a p a   i s   t h e   b e s t !\""]},{"code":["_cmd = currentMagazineDetail player; // \"9mm 16Rnd Mag(13/16)[id/cr:10000011/0]\"\n_cmd splitString \"([ ]/:)\"; // [\"9mm\",\"16Rnd\",\"Mag\",\"13\",\"16\",\"id\",\"cr\",\"10000011\",\"0\"]"]},{"text":"Remove all \\r\\n from file:\n\n```sqf\nloadFile \"somefile.txt\" splitString toString [13,10] joinString \" \";\n```","code":["loadFile \"somefile.txt\" splitString toString [13,10] joinString \" \";"]}],"see_also":["joinString","set","resize","reverse","select","in","find","toArray","forEach","count","deleteAt","deleteRange","append","sort","param","params","arrayIntersect","toString","endl","forceUnicode"],"notes":[{"user":"BaerMitUmlaut","date":"2016-05-17T14:18:00Z","text":"This command is unreliable/broken when it comes to some non-ASCII characters (as of Arma 3 v1.58):\n\n```sqf\n\"Mörser\" splitString \"\" // -> [\"M\",\" \",\" \",\"r\",\"s\",\"e\",\"r\"]\n\"Mörser\" splitString \"ö\" // -> [\"M\",\"rser\"]\n\"Mörser\" splitString \"ä\" // -> [\"M\",\" rser\"]\n```"},{"user":"Killzone_Kid","date":"2016-10-17T14:03:00Z","text":"This commands works only with ASCII chars, any chars with codes > 127, also used in different languages, will be converted to [\" \", \" \"]. Use toArray to preserve special characters:\n\n```sqf\n_spaced = toArray \"Mörser\" apply {toString [_x]} joinString \" \"; // M ö r s e r\n```"},{"user":"R3vo","date":"2019-07-19T11:17:00Z","text":"When working with string which contain linebreaks...\n\n```sqf\n\"stringWith\" + endl + \"Linebreak\" splitString \",; \";\n/*\nresult is [\"someStringWith\nLinebreak\"]\n*/\n```\n\n...one can remove those by adding endl as delimiter\n\n```sqf\n\"stringWith\" + endl + \"Linebreak\" splitString \",; \" + endl; // result is [\"someStringWith\",\"Linebreak\"]\n```"}]}