{"name":"trim","title":"trim","type":"command","url":"https://community.bistudio.com/wiki/trim","revid":377062,"updated":"2026-01-01T09:06:47Z","groups":["Strings"],"status":"ok","games":{"arma3":"2.02"},"since":"arma3 2.02","arma3_since":"2.02","description":"Trims a string.","syntaxes":[{"syntax":"trim stringValue","params":[{"name":"stringValue","type":"String","description":"string to be trimmed. spaces, tabs and line returns are removed from both ends of *stringValue*.","type_expr":"String"}],"returns":{"type":"String","type_expr":"String","description":"trimmed string"},"form":"unary","right":{"text":"stringValue"}},{"syntax":"string trim [chars, where]","params":[{"name":"string","type":"String","description":"string to be trimmed","type_expr":"String"},{"name":"chars","type":"String","description":"list of characters to be trimmed","type_expr":"String"},{"name":"where","type":"Number one of:","description":"Number one of:\n\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)","type_expr":"Number","text":"where: Number one of:\n\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","type_expr":"String","description":"trimmed string"},"form":"binary","left":{"text":"string"},"right":{"text":"[chars, where]"}}],"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?\""]},{"code":["\"hewosentence!123\" trim [\"3e1o2hw\", 0]; // returns \"sentence!\""]}],"see_also":["select"]}