Forum Discussion
Romel_77740
Nimbostratus
Aug 03, 2010string manipulation
-- I have a string S. There is a character '>' in S. I want to insert a new string in between '>' and the character before '>'. What's the best way to do this?
-- I have a string S. There is a charac...
hoolio
Cirrostratus
Aug 04, 2010Maybe something like these?
set str1 "12344384616;cic=0335@@645.444.44"
scan $str1 and save everything that isn't a ; into a.
Save everything after ; up to the next @ into b
Save everything after the @ into c
scan $str1 {%[^;];%[^@]@%s} a b c
Append $a and $c
set str1_edited "$a$c"
Result: 12344384616@645.444.44
Replace all >'s with inserted_string>
string map {">" "inserted_string>"} "<34384616@66.106ddsdsd>"
Result: <34384616@66.106ddsdsdinserted_string>
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects