Forum Discussion
string trim generating strange results
Hi,
I have an issue with one of my string manipulations with variables:
set test [ACCESS::session data get session.http.last.response_cookie]
set test [lindex [split $test "|"] 0]
set test [string trim $test "Test="]
So, my cookie is built up like this:
- example: Test=ZTR(abc1234-1);ABC(qwe12314);|version=1;...
- example: Test=OEZZV(abc1234);ABC(qwe12314);|version=1...
In the first example, my $test ends up being correctly shown as "ZTR(abc1234-1);ABC(qwe12314);". In the second one, $test ends up being "ZZV(abc1234);ABC(qwe12314);".
So the "OE" is stripped away, although it shouldn't be. I've read about some odd results with trim when using numbers and I assume that this occurs because the OE (letter O, not number 0) represents some kind of value that is handled by the F5 differently.
But can anyone tell why and how to mitigate this? Is it possible to handle the variable as a string variable or similar, so that these changes of the values are not done?
Thanks in advance!
- Stanislas_Piro2Cumulonimbus
you can split header values with following code:
split with both = and | characters and create an array array set cookie [split $test "=|"] get the value of cookie named Test set test2 $cookie(Test)
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