在Jmeter shell断言中,我将返回值存储到一个字符串中。返回的字符串带有下划线。它会带下划线显示。虽然我不能在下面的文字中显示下划线。
https://myhost.com:1234/abc/def/ghi
我必须解析上面的字符串才能在http reuquerst中使用它。为此,我使用URI/URL类来获取主机名、端口和路径等;但只有在去掉文本中的下划线之后,所有这些才能起作用。我怎么才能摆脱下划线。
发布于 2015-12-19 17:08:47
您可以使用String.replaceAll()方法删除同一Beanshell断言中的下划线,如下所示:
String myString = "your_string_with_underscores";
myString = myString.replaceAll("_","");
// do what you need with the "sanitized" string有关更多Beanshell提示和技巧,请参阅How to Use BeanShell: JMeter's Favorite Built-in Component文章。
https://stackoverflow.com/questions/34364983
复制相似问题