Please tell me way to remove = and newline character \n from the end of string which is embedded between <>.
For example input string
set string "abcd 1234 abc=
"
i just want to remove = and new line from end
If you want to remove all = and newlines from the end, no matter how much there are, I suggest string trimright
set string "abcd 1234 abc=
"
string trimright $string =\n
set str2 "abc===="
string trimright $str2 =\n ; returns abc
If you know that the last 2 characters are =\n, you can also use string range
string range $string 0 end-2
For more complex solutions, regexp is appropriate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With