12.5.1         append

Description:   Append a text string to a variable

Syntax:         append varName ?string string string ...?

         

Argument:     variable name, a list of strings

Returns:         text string  of values

See Also:       foreach, lappend, concat, list

 

Examples:     

# Trim any leading/trailing spaces and add computer name

set text25 [string trim $text]

    if {[string length $text25)] > 0} {

        append text25 [info hostname]

    }

 

Appends all of the sting values to the variable varName. If varName doesn’t exist, it is created with a value equal to the concatenation of all the value arguments. Usually the command is used to build long variables incrementally.

For example, ‘‘append a $b $c’’ is the same as ‘‘set a $a$b$c’’, just shorter.  The result of append is usually treated as a string.  Use lappend to create a list of values.