How to remove spaces in a string in TCL?

I need to separate leading and trailing spaces from a string in TCL. How?

+4
source share
2 answers

Try it -

line cropping string? chars?

Returns a value equal to the string, except that any leading or trailing characters from the set specified by characters are deleted. If no characters are specified, the space is removed (spaces, tabs, newlines, and carriage returns).

Source of the original: - http://wiki.tcl.tk/10174

+13
source

try it. this will remove all withe spaces

[string map {" " ""} $a]; 

a is your string

0
source

Source: https://habr.com/ru/post/1335080/


All Articles