Deleting unnecessary symbols from variable in Jmeter -


i have variable string in view:

["564546","56454654","3123123","868987"] 

i need script deletes unnecessary symbols [ ] " , put variable . (something trim method) assume should made in beanshell pre-processor.

it can done via beanshell preprocessor follows:

  1. add beanshell preprocessor child of request needs "another variable"
  2. put following code preprocessor's "script" area:

    string yourvar = vars.get("yourvar"); string anothervar = yourvar.replace("[","").replace("]","").replaceall("\\\"",""); vars.put("anothervar",anothervar); 

change "yourvar" , "anothervar" according variables reference names.

  • yourvar - source variable name
  • anothervar - result variable name

vars shorthand jmetervariables class instance provides access jmeter variables in current context. see javadoc class available methods , how use beanshell: jmeter's favorite built-in component guide advanced information on beanshell scripting in jmeter.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -