Reputation: 1113
Say I have the following variable s:
set s [lindex $argv 0]
How can I make sure s does not contain any "-" characters?
So, basically I want to replace all occurrences of "-" in s with "".
How can I achieve it?
Upvotes: 1
Views: 488
Reputation: 4372
Use set s [string map { - {} } [lindex $argv 0]]
As pynexj says, details can be found at http://www.tcl-lang.org/man/tcl/TclCmd/string.htm#M34
Upvotes: 1