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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -