Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 tcl 的新手,我喜欢你帮助在 Tcl 中的单词之间提供动态变量间距。示例:“堆栈溢出”“堆栈”中包含 5 个字母。所以我必须给 5 个空间来开始下一个单词,下一个单词也是如此。
Output: Stack over flow
我想你可以这样做:
set example "Stack over flow" set result "" foreach word $example { append result $word [string repeat " " [string length $word]] } set result [string trim $result] puts $result
会给:
Stack over flow