Example usage for org.apache.commons.lang StringUtils removeEnd

List of usage examples for org.apache.commons.lang StringUtils removeEnd

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils removeEnd.

Prototype

public static String removeEnd(String str, String remove) 

Source Link

Document

Removes a substring only if it is at the end of a source string, otherwise returns the source string.

Usage

From source file:com.laxser.blitz.util.BlitzStringUtil.java

public static String relativePathToModulePath(String relativePath) {
    if (relativePath == null) {
        throw new NullPointerException();
    }//from  w  ww  . j  a  va 2  s .  c  o m
    if (relativePath.length() == 0) {
        return "";
    }
    return StringUtils.removeEnd("/" + relativePath, "/");
}

From source file:com.laxser.blitz.util.BlitzStringUtil.java

public static String mappingPath(String mappingPath) {
    if (mappingPath.length() != 0) {
        mappingPath = StringUtils.removeEnd(mappingPath, "/");
        while (mappingPath.indexOf("//") != -1) {
            mappingPath = mappingPath.replace("//", "/");
        }//from   www.  j  ava  2s .c om
    }
    return mappingPath;
}

From source file:com.iggroup.oss.restdoclet.doclet.util.UrlUtils.java

/**
 * Convert a URI list in the form of {"","",...""} into a String[] of URIs
 * /*from   w  w w .j  a v a2  s  .com*/
 * @param multiUri URI list in the form "" or {"","",...""}
 * @return URIs
 */
public static String[] parseMultiUri(final String multiUri) {

    String value;

    value = StringUtils.removeStart(multiUri.trim(), "{");
    value = StringUtils.removeEnd(value, "}");
    value = value.replace("\"", "");
    value = value.replaceAll("\\s", "");

    return value.split(",");
}

From source file:com.intuit.tank.rest.RestUrlBuilder.java

/**
 * @param baseUrl
 */
public RestUrlBuilder(@Nonnull String baseUrl) {
    this.baseUrl = StringUtils.removeEnd(baseUrl, "/");
}

From source file:com.ewcms.content.resource.web.InsertAction.java

@Override
public String execute() {
    context = ServletActionContext.getRequest().getContextPath();
    context = StringUtils.removeEnd(context, "/");

    return SUCCESS;
}

From source file:com.ewcms.content.resource.web.RecycleAction.java

public String input() {
    context = ServletActionContext.getRequest().getContextPath();
    context = StringUtils.removeEnd(context, "/");

    return Action.SUCCESS;
}

From source file:ch.algotrader.util.HibernateUtil.java

private static AbstractEntityPersister getEntityPersister(SessionFactory sessionFactory, Class<?> type) {

    String className = StringUtils.removeEnd(type.getName(), "Impl") + "Impl";
    SessionFactoryImpl sessionFactoryImpl = (SessionFactoryImpl) sessionFactory;
    return (AbstractEntityPersister) sessionFactoryImpl.getEntityPersister(className);
}

From source file:ips1ap101.ejb.core.BeanLocator.java

private static Object lookup(Class<?> local) {
    Bitacora.trace(BeanLocator.class, "lookup", local);
    String key = EAC.JNDI_EJB_LOOKUP_PATTERN;
    String pattern = EA.getString(key);
    String name = local.getSimpleName();
    String root = StringUtils.removeEnd(name, LOCAL_SUFFIX);
    String arg0 = root + BEANS_SUFFIX;
    String arg1 = local.getName();
    String jndi = MessageFormat.format(pattern, arg0, arg1);
    Bitacora.trace(key + "=" + pattern);
    Bitacora.trace(key + "=" + jndi);
    try {/*w  w  w  .  java2  s  . com*/
        Object object = InitialContext.doLookup(jndi);
        boolean assignable = object != null && local.isAssignableFrom(object.getClass());
        Bitacora.trace(arg0 + "=" + object + ", assignable=" + assignable);
        return object;
    } catch (NamingException ex) {
        return null;
    }
}

From source file:com.adobe.adobemarketingcloud.github.maven.scq.di.MojoConfiguration.java

public static String makeUrl(String url) {
    if (StringUtils.isBlank(url)) {
        return url;
    }//from  w w  w .ja  va 2s.  com
    String result = StringUtils.removeEnd(url, "/");
    if (!result.startsWith("http://") && !result.startsWith("https://")) {
        result = StringUtils.removeStart(result, "/");
        result = "http://" + result;
    }
    return result;
}

From source file:com.netflix.paas.dao.astyanax.AstyanaxDao.java

private static String entityNameFromClass(Class<?> entityType) {
    return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,
            StringUtils.removeEnd(StringUtils.substringAfterLast(entityType.getName(), "."), "Entity"));
}