Forum Discussion
Delete a substring
Hi,
I need to delete a substring from [HTTP::payload] before I pass it on for load-balancing but am running into problems with the error "char map list unbalanced ..
I need to strip two strings out completely and have tried using "string map" and "string replace" - this works fine when substituting for another string but not when substituting an empty string or tab / newline character ..
Surely there must be a simple way to do this ?!
Thanks!
e.g. the following works fine for "xyz" but fails for ""
set strSubstitute ""
set strSubstitute "xyz"
set strHTTPPayload [HTTP::payload]
set strHTTPPayload [ string map -nocase "$strOne $strSubstitute" $strHTTPPayload ]
set strHTTPPayload [ string map -nocase "$strTwo $strSubstitute" $strHTTPPayload ]
I've used this syntax before to remove spaces (%20) from URIs. Maybe you could use curly brackets instead of double quotes.
set new_uri [string map {"%20" ""} $uri]
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