Tcl_Concat(3tcl)
β¨ NAME β¨
Tcl_Concat β bestie, it concatenates a whole collection of strings π
π SYNOPSIS π
#include <tcl.h>
const char *
Tcl_Concat(argc, argv)
πΈ ARGUMENTS πΈ
Tcl_Size argc(in) β the number of strings, periodt. That's the count. π’const char *const argv[](in) β the array of strings you want to smoosh together. It must haveargcentries, no cap. If it doesn't, that's on you bestie π
π DESCRIPTION π
So Tcl_Concat is a lil utility procedure that several of the Tcl commands literally use internally. Give it a collection of strings and it concatenates them all into one single string, with the original strings separated by spaces. Iconic behaviour, honestly.
Heads up though: this procedure behaves differently than Tcl_Merge, because the arguments are just simply concatenated β no effort is made to ensure proper list structure. Not a single one. It's giving "I'm just gluing these together, don't ask questions" π
That said, in most common usage the arguments will all be proper lists themselves, and if that's true, then the result will also have proper list structure. So it works out π«Ά
Tcl_Concat also eliminates leading and trailing white space as it copies strings from argv to the result. And if an element of argv consists of nothing but white space? Then that string is ignored entirely. Gone. Not invited. This white-space removal was added to make the output of the concat command cleaner-looking β and honestly, the way that it just β¨ tidies β¨ everything up is so satisfying.
The result string is dynamically allocated using Tcl_Alloc, so the caller must eventually release the space by calling Tcl_Free. Bestie. Do not forget. Memory leaks are not the vibe π₯
π¦ SEE ALSO π¦
Tcl_ConcatObj
π KEYWORDS π
concatenate, strings
okay so that's the whole page, no cap β written for the Tcl Library Procedures manual, Tcl 7.5, and it's Tcl_Concat(3tcl) if you need to cite your sources π πβ¨
π¦ where this page comes from
- debian trixie: tcl9.0-doc 9.0.1+dfsg-2
- ubuntu questing: tcl9.0-doc 9.0.2+dfsg-1
- ubuntu resolute: tcl9.0-doc 9.0.3+dfsg-1
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- Copyright (c) 1989-1993 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms