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:
- add beanshell preprocessor child of request needs "another variable"
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 nameanothervar
- 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
Post a Comment