{"name":"trim","operator":null,"title":"trim","type":"command","url":"https://community.bistudio.com/wiki/trim","revid":377062,"updated":"2026-01-01T09:06:47Z","groups":["Strings"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"2.02"}],"since":{"game":"arma3","name":"Arma 3","version":"2.02"},"arma3_since":"2.02","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Trims a string.","syntaxes":[{"syntax":"trim stringValue","since":null,"effect":null,"exec":null,"params":[{"name":"stringValue","type":"String","optional":false,"default":null,"description":"string to be trimmed. spaces, tabs and line returns are removed from both ends of *stringValue*.","types":["String"],"since":null,"text":"stringValue: String - string to be trimmed. spaces, tabs and line returns are removed from both ends of *stringValue*."}],"returns":{"type":"String","types":["String"],"description":"trimmed string","text":"String - trimmed string"},"form":"unary","operator":null,"left":null,"right":{"text":"stringValue","types":["String"]}},{"syntax":"string trim [chars, where]","since":null,"effect":null,"exec":null,"params":[{"name":"string","type":"String","optional":false,"default":null,"description":"string to be trimmed","types":["String"],"since":null,"text":"string: String - string to be trimmed"},{"name":"chars","type":"String","optional":false,"default":null,"description":"list of characters to be trimmed","types":["String"],"since":null,"text":"chars: String - list of characters to be trimmed"},{"name":"where","type":"Number one of:","optional":false,"default":null,"description":"Number one of:\n- 0 - trim at the beginning (left) and the end (right)\n- 1 - trim at the beginning (left)\n- 2 - trim at the end (right)","types":["Number"],"since":null,"text":"where: Number one of:\n- 0 - trim at the beginning (left) and the end (right)\n- 1 - trim at the beginning (left)\n- 2 - trim at the end (right)"}],"returns":{"type":"String","types":["String"],"description":"trimmed string","text":"String - trimmed string"},"form":"binary","operator":null,"left":{"text":"string","types":["String"]},"right":{"text":"[chars, where]","types":["Array"]}}],"examples":[{"text":"```sqf\ntrim \"        hello, how are you?  \"; // returns \"hello, how are you?\"\n```","code":["trim \"\t\thello, how are you?  \"; // returns \"hello, how are you?\""]},{"text":"```sqf\n\"hewosentence!123\" trim [\"3e1o2hw\", 0]; // returns \"sentence!\"\n```","code":["\"hewosentence!123\" trim [\"3e1o2hw\", 0]; // returns \"sentence!\""]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["select"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Strings","Introduced with Arma 3 version 2.02","Scripting Commands"]}