Reputation: 2284
I need to strip leading and trailing whitespace from a string in TCL. How?
Upvotes: 7
Views: 28098
Reputation: 11
try this. this will remove all the withe spaces
[string map {" " ""} $a];
a is your string
Upvotes: 0
Reputation: 55489
Try this -
string trim string ?chars?
Returns a value equal to string except that any leading or trailing characters from the set given by chars are removed. If chars is not specified then white space is removed (spaces, tabs, newlines, and carriage returns).
Original Source :- http://wiki.tcl.tk/10174
Upvotes: 15