# AutoTrim

Determines whether "Var1 = %Var2%" statements omit spaces and tabs from the beginning and end of Var2.

    AutoTrim, On|Off

### Parameters

On|Off | On: In a statement such as Var1 = %Var2%, tabs and spaces at the beginning and end of a Var2 are omitted from Var1. This is the default. Off: Such tabs and spaces are not omitted. Any literal tabs and spaces are omitted regardless of this setting. Prior to v1.1.06, this included `t and any escaped literal spaces or tabs. For example, when AutoTrim is Off, the statement Var = `t assigns a tab character on v1.1.06 and an empty string on earlier versions.

### Remarks

If this command is not used by a script, the setting defaults to ON.

The built-in variable A_AutoTrim contains the current setting (On or Off).

The built-in variables A_Space and A_Tab contain a single space and single tab character, respectively.

AutoTrim does not affect expression assignments such as Var := " string ". In other words, leading and trailing spaces and tabs are always retained in such cases.

Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).

### Related

SetEnv

### Examples

    AutoTrim, off
    NewVar1 = %OldVar%  ; If OldVar contains leading and trailing spaces, NewVar will have them too.
    NewVar2 = %A_Space%  ; With AutoTrim off, a single space can be assigned this way.

    Var1 := "`t" . Var2 . " "  ; The setting of AutoTrim doesn't matter because this is an expression.