Forum Discussion
tony_haynes_247
Nimbostratus
Oct 23, 2007convert string into an integer
I need to convert a variable string "mserver_number" that contains a number"string" into an integer. I need to take that integer so I can build a loop where my loop number starts as the "mserver_numb...
hoolio
Cirrostratus
Oct 24, 2007Does your data literally look like mserver_2 or mswerver_10? And you're trying to parse that string to get just the digits after the underscore? If so, you can use getfield to split the string and take just the second field:
set test_string mserver_9
set digit [getfield $test_string "_" 2]
log local0. $digit
This logs 9. If this isn't what you meant, can you clarify?
Thanks,
Aaron
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