How to extract integer value from string in Katalon Studio?

0

How to extract integer value from string in Katalon Studio?

Answered question
0

In order to extract integer value from string firstly we will create a variable in which we will get the string

items = WebUI.getText(findTestObject('abc/testobject')

Now to extract integer write the below code in the script

String d = items.replaceAll("[^0-9]", "");

This will give the integer value into string type, no we will parse it in integer type, to do so use the following code-

result = Integer.parseInt(d)
println(result)

This will print the integer value in console.

Answered question