Example usage for org.apache.commons.lang3 StringUtils reverseDelimited

List of usage examples for org.apache.commons.lang3 StringUtils reverseDelimited

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils reverseDelimited.

Prototype

public static String reverseDelimited(final String str, final char separatorChar) 

Source Link

Document

Reverses a String that is delimited by a specific character.

The Strings between the delimiters are not reversed.

Usage

From source file:fr.lirmm.graphik.graal.core.term.DefaultLiteral.java

public DefaultLiteral(Object value) {
    boolean test = false;
    Matcher m = null;/*from  w  w w. j a v a  2s .  co m*/
    if (value instanceof String) {
        m = pattern.matcher((String) value);
        test = m.matches();
    }
    if (test) {
        this.datatype = URIUtils.createURI(m.group(2));
        this.value = m.group(1);
    } else {
        this.datatype = URIUtils
                .createURI("java:" + StringUtils.reverseDelimited(value.getClass().getCanonicalName(), '.'));
        this.value = value;
    }
    this.identifier = "\"" + this.value.toString() + "\"^^<" + this.getDatatype().toString() + ">";
}

From source file:org.lazydog.jdnsaas.utility.ZoneUtility.java

/**
 * Get the IP (v4 or v6) address./*from   w w  w .  j  av  a2 s  .  c  o  m*/
 * 
 * @param  reverseTets  the IP address tets in reverse.  These are the octets (IPv4) or hextets (IPv6) not in the zone name.
 * 
 * @return  the IP (v4 or v6) address.
 */
public String getIpAddress(String reverseTets) {
    String reverseDomain = (this.isIpv4ReverseZone()) ? IPV4_REVERSE_DOMAIN : IPV6_REVERSE_DOMAIN;
    return StringUtils.reverseDelimited(
            reverseTets + LABEL_SEPARATOR
                    + StringUtils.removeEnd(this.relativeZoneName, LABEL_SEPARATOR + reverseDomain),
            LABEL_SEPARATOR.charAt(0));
}

From source file:org.lazydog.jdnsaas.utility.ZoneUtility.java

/**
 * Get the reverse tets.  /*from   w ww .j a  v  a  2 s  .c o  m*/
 * These are the octets (IPv4) or hextets (IPv6) not in the zone name.
 * 
 * @param  ipAddress  the IP (v4 or v6) address.
 * 
 * @return  the reverse tets.
 */
public String getReverseTets(String ipAddress) {
    String reverseDomain = (this.isIpv4ReverseZone()) ? IPV4_REVERSE_DOMAIN : IPV6_REVERSE_DOMAIN;
    return StringUtils.removeEnd(StringUtils.reverseDelimited(ipAddress, LABEL_SEPARATOR.charAt(0)),
            LABEL_SEPARATOR + StringUtils.removeEnd(this.relativeZoneName, LABEL_SEPARATOR + reverseDomain));
}

From source file:org.wrml.werminal.Werminal.java

public URI createSchemaUri(final String simpleSchemaName) {

    final String systemUserName = System.getProperty("user.name");

    final String appUserName = (systemUserName != null && !systemUserName.isEmpty()) ? systemUserName
            : "user " + getClass().getSimpleName() + " wrml";
    String userNamespace = StringUtils.replace(appUserName, " ", "/");
    userNamespace = StringUtils.reverseDelimited(userNamespace, '/');

    // TODO: Make the userNamespace an option or setting or preference (in the Werminal tool options dialog)

    userNamespace = userNamespace.toLowerCase();

    final UniqueName newSchemaUniqueName = new UniqueName("org/" + userNamespace, simpleSchemaName);
    final URI schemaUri = URI
            .create(SystemApi.Schema.getUri().toString() + "/" + newSchemaUniqueName.toString());

    return schemaUri;
}