Forum Discussion
TCL issue with "backslash substitution"
Hello all, I am having a problem using an iApp while reading some parameters. In my presentation section, I have a table and the issue comes when parsing the elements. I get them using the "lindex" command. The problem here is that due to the backslash substitution parameters such as "\myserver\my_path" are not propperly read (in this case, the result would be "\myservermypath"). As far as I know, the lindex command makes this substitutions, and there is not another way to parse the elements of a table, as this is actually a TCL list. An easy example would be, having a list like this set mylist {"\myserver\mypath" "foo" "bar"} puts [something_like_lindex $mylist 0]
And print exactly \myserver\mypath Any ideas about this? Thanks in advance for your help
2 Replies
- Fred_Slater_856Historic F5 Account
Escape the backslashes with backslashes, using string map. For example, [string map {\\ \\\\} $foo].
- estradjs_130284
Nimbostratus
Thanks for your answer Fred, Your solution works for the \ problem, but I still have the same problem with single backslashes. The ideal should be [string map {\ \} $foo} but this doesn't work. I have also tried with subst and it didn't work neither. I think the only solution for this is a regular expresion (regsub) to substitute the backslash plus any letter for a double backslash plus the same letter.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com