class VersioningUtils {

    public static final String getExpression(String appName)
            throws VersioningSyntaxException {

        if(appName != null && !appName.isEmpty()) {
            int colonIndex = appName.indexOf(EXPRESSION_SEPARATOR);
            // if the appname contains a EXPRESSION_SEPARATOR
            if (colonIndex >= 0){
                if (colonIndex == 0) {
                    // if appName is starting with a colon
                    throw new VersioningSyntaxException(
                            LOCALSTRINGS.getLocalString("versioning.deployment.invalid.appname1",
                            "excepted application name before colon: {0}",
                            appName));
                } else if (colonIndex == (appName.length() - 1)) {
                    // if appName is ending with a colon
                    throw new VersioningSyntaxException(
                            LOCALSTRINGS.getLocalString("versioning.deployment.invalid.appname2",
                            "excepted version identifier after colon: {0}",
                            appName));
                }
                // versioned
                return appName.substring(colonIndex + 1, appName.length());
            }
        }
        // not versioned
        return null;
    }

}