append lappend concat

append puts one string directly on the end of another, without adding any extra characters beyond those in the incoming variables.

lappend treats the target string as a list, and will usually add an extra space on the end of it prior to appending the new item so that the result is also a list with ONE new item added ... the added item being protected using additional characters such as { and } to turn it into a list element if necessary.

concat (and note the different syntax!) takes two LISTS and joins them together - it differs from lappend in that lappend takes the second element as a single item and not as a list. Concat is something that many occasional Tcl users seem to forget about ... and then waste time writing a loop of lappends!

posted @ 2013-12-30 23:38  greencolor  阅读(577)  评论(0编辑  收藏  举报