Handle get partial text and use it on other input element

Let say I have some element with text “Your queue number is 12345”

How do I get only the “12345”, and use it to input in other menu?

I have tried method substring on custom keyword and it doesn’t work

Hello,

is your text always the same? I mean only that ID is variable. If so. you can do this:

String myText = "Your queue number is 12345"
String myId = myText.split("Your queue number is ")[1]

WebUI.setText(yourTestObject, myId)

This is my code for custom keyword

String str = WebUI.getText(findTestObject(object)).trim()

String result = trim.split("Your queue number is ")[1]

return result

But when I do this, I get error

com.kms.katalon.core.exception.StepErrorException: Error = groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject) values: [TestObject - ‘object’’]
Possible solutions: findTestObject(java.lang.String), findTestObject(java.lang.String, java.util.Map)

Do this instead.

String str = WebUI.getText(object).trim()

thanks it works now