Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
17 years ago

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

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    try

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

    (not very error-safe.. )

    regards!

    /Ole
    eviware.com