Ask a Question

Groovy help

alibaba82
Super Contributor

Groovy help

hello,
seems like a very simple problem but having a hard time

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
String projectName= groovyUtils.projectPath.toString();

My project name will typically be something like
Sat Dec 15 10:58:09 PST 2007:INFO:C:\Workspace\Automation\soapUI_Scripts\Phase3.0\Integration_Environment\UserProfileService

I want to capture the last token evertime. So in the above example I want to capture 'UserProfileService'

How can I do this.

thanks

Ali
1 REPLY 1
omatzura
Super Contributor

Re: Groovy help

Hi Ali,

try

def token = projectName.substring( projectName.lastIndexOf( java.io.File.separator )+1 )

(not very error-safe.. )

regards!

/Ole
eviware.com
cancel
Showing results for 
Search instead for 
Did you mean: