{"name":"splitString","operator":null,"title":"splitString","type":"command","url":"https://community.bistudio.com/wiki/splitString","revid":377128,"updated":"2026-01-01T10:23:07Z","groups":["Strings"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.50"}],"since":{"game":"arma3","name":"Arma 3","version":"1.50"},"arma3_since":"1.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"str","type":"String","optional":false,"default":null,"description":"the string to split","types":["String"],"since":null,"text":"str: String - the string to split"},{"name":"delimiters","type":"String","optional":false,"default":null,"description":"one or more characters, each used as a separate delimiter; if empty, *str* is split by each character","types":["String"],"since":null,"text":"delimiters: String - one or more characters, each used as a separate delimiter; if empty, *str* is split by each character"}],"returns":{"type":"Array of Strings","types":["Array","String"],"description":null,"text":"Array of Strings"},"form":"binary","operator":null,"left":{"text":"str","types":["String"]},"right":{"text":"delimiters","types":["String"]}}],"examples":[{"text":"```sqf\n_str = \"- This, is a sample string.\" splitString \"-,. \"; // [\"This\",\"is\",\"a\",\"sample\",\"string\"]\n_str joinString \"#\"; // \"This#is#a#sample#string\"\n```","code":["_str = \"- This, is a sample string.\" splitString \"-,. \"; // [\"This\",\"is\",\"a\",\"sample\",\"string\"]\n_str joinString \"#\"; // \"This#is#a#sample#string\""]},{"text":"```sqf\n\"\\A3\\ui_f\\data\\map\\vehicleicons\\iconLogic_ca.paa\" splitString \"\\.\"; // [\"A3\",\"ui_f\",\"data\",\"map\",\"vehicleicons\",\"iconLogic_ca\",\"paa\"]\n```","code":["\"\\A3\\ui_f\\data\\map\\vehicleicons\\iconLogic_ca.paa\" splitString \"\\.\"; // [\"A3\",\"ui_f\",\"data\",\"map\",\"vehicleicons\",\"iconLogic_ca\",\"paa\"]"]},{"text":"```sqf\n\"1:2:3\" splitString \":\"; // [\"1\",\"2\",\"3\"]\n```","code":["\"1:2:3\" splitString \":\"; // [\"1\",\"2\",\"3\"]"]},{"text":"```sqf\n\"Japa is the best!\" splitString \"\" joinString \" \"; // \"J a p a   i s   t h e   b e s t !\"\n```","code":["\"Japa is the best!\" splitString \"\" joinString \" \"; // \"J a p a   i s   t h e   b e s t !\""]},{"text":"```sqf\n_cmd = currentMagazineDetail player; // \"9mm 16Rnd Mag(13/16)[id/cr:10000011/0]\"\n_cmd splitString \"([ ]/:)\"; // [\"9mm\",\"16Rnd\",\"Mag\",\"13\",\"16\",\"id\",\"cr\",\"10000011\",\"0\"]\n```","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 \" \";"]}],"multiplayer":null,"problems":null,"aliases":[],"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```"}],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Strings","Introduced with Arma 3 version 1.50","Scripting Commands"]}