Forum Discussion
String map help
Hi all,
Could you please explain the difference between the two commands below?
HTTP::uri [string map "/$customer/ /" [HTTP::uri]]
HTTP::uri [string map {"/$customer/" "/"} [HTTP::uri]]
Thanks.
- Humair_167681Nimbostratus
Thanks Joe,
Can you please elaborate "the second command is expressly setting the correct type for the mapping parameter"?
Sorry - I don't seem to understand what you mean there.
Regards,
Humair
I believe they are functionally equivalent. But, the second command is expressly setting the correct type for the mapping parameter. Most likely is that TCL is seeing you are passing in a string in the first command and trying to coerce it to an list of search/replace strings which that parameter is supposed to represent. Since you have a space in that string, it's convering it to the equivalent of 2.
In an example with the TCL interpreter (tclsh), here's something similar:
% set s 123456 123456 % string map {1 a} $s a23456 % string map "1 a" $s a23456
-Joe
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