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

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

Introduction

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

Prototype

public static String removeStart(String str, String remove) 

Source Link

Document

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

Usage

From source file:com.intel.cosbench.driver.iterator.NumericNameIterator.java

@Override
public String next(String curr) {
    int value;/*from w  w w  .  j  av  a2 s  .  c om*/
    if (StringUtils.isEmpty(curr)) {
        if ((value = iterator.next(0)) <= 0)
            return null;
        return StringUtils.join(new Object[] { prefix, value, suffix });
    }
    curr = StringUtils.removeStart(curr, prefix);
    curr = StringUtils.removeEnd(curr, suffix);
    if ((value = iterator.next(Integer.parseInt(curr))) <= 0)
        return null;
    return StringUtils.join(new Object[] { prefix, value, suffix });
}

From source file:com.antsdb.saltedfish.sql.mysql.System_variable_referenceGenerator.java

@Override
public Instruction gen(GeneratorContext ctx, System_variable_referenceContext rule) throws OrcaException {
    String name = rule.SYSTEM_VARIABLE().getText();
    name = StringUtils.removeStart(name, "@@");
    return new GetSystemVarible(name);
}

From source file:com.adobe.acs.commons.workflow.bulk.execution.model.Failure.java

public String getPath() {
    return StringUtils.removeStart(path, "-");
}

From source file:com.antsdb.saltedfish.sql.mysql.Load_data_infile_stmtGenerator.java

@Override
public Instruction gen(GeneratorContext ctx, Load_data_infile_stmtContext rule) throws OrcaException {
    String filename = rule.file_name().getText();
    filename = StringUtils.removeStart(filename, "\'");
    filename = StringUtils.removeEnd(filename, "\'");
    ObjectName tableName = TableName.parse(ctx, rule.table_name_());
    LoadCsv instru = new LoadCsv(new File(filename), tableName);
    return instru;
}

From source file:com.ctc.storefront.web.wrappers.UrlEncodeHttpRequestWrapper.java

@Override
public String getRequestURI() {
    final String originalRequestURI = super.getRequestURI();
    final String originalContextPath = super.getContextPath();
    final String contextPath = this.getContextPath();
    final String originalRequestUriMinusAnyContextPath;

    if (StringUtils.startsWith(originalRequestURI, contextPath)) {
        originalRequestUriMinusAnyContextPath = StringUtils.removeStart(originalRequestURI, contextPath);
    } else if (StringUtils.startsWith(originalRequestURI, originalContextPath)) {
        originalRequestUriMinusAnyContextPath = StringUtils.removeStart(originalRequestURI,
                originalContextPath);//from  www .  j a va 2 s . c o m
    } else {
        originalRequestUriMinusAnyContextPath = originalRequestURI;
    }

    return getContextPath() + originalRequestUriMinusAnyContextPath;
}

From source file:com.adobe.acs.commons.workflow.bulk.execution.model.Failure.java

public String getPayloadPath() {
    return StringUtils.removeStart(payloadPath, "-");
}

From source file:ips1ap101.lib.core.app.OrdenConjuntoResultados.java

@Override
public String toString() {
    String order = StringUtils.EMPTY;
    String token;//from   www .  j  a v  a2  s . c o m
    for (CriterioOrden criterio : criterios) {
        token = criterio.toString();
        order += StringUtils.isBlank(token) ? "" : COMA + token;
    }
    order = StringUtils.removeStart(order, COMA);
    return StringUtils.trimToNull(order);
}

From source file:com.aqnote.shared.cryptology.cert.tool.PrivateKeyTool.java

private static byte[] getKeyEncoded(String base64KeyFile) {
    if (StringUtils.isEmpty(base64KeyFile)) {
        return null;
    }/* w ww  . j a  v  a 2s .  com*/

    String tmpBase64KeyFile = base64KeyFile;
    String headLine = BEGIN_KEY + lineSeparator;
    if (base64KeyFile.startsWith(headLine)) {
        tmpBase64KeyFile = StringUtils.removeStart(base64KeyFile, headLine);
    }
    headLine = BEGIN_KEY + "\r\n";
    if (base64KeyFile.startsWith(headLine)) {
        tmpBase64KeyFile = StringUtils.removeStart(base64KeyFile, headLine);
    }

    if (tmpBase64KeyFile.endsWith(END_KEY)) {
        tmpBase64KeyFile = StringUtils.removeEnd(base64KeyFile, END_KEY);
    }

    return Base64.decodeBase64(tmpBase64KeyFile);
}

From source file:models.PushedBranch.java

public String getShortName() {
    return StringUtils.removeStart(this.name, Constants.R_HEADS);
}

From source file:com.egt.core.aplicacion.OrdenConjuntoResultados.java

@Override
public String toString() {
    String order = StringUtils.EMPTY;
    String token = StringUtils.EMPTY;
    for (CriterioOrden criterio : criterios) {
        token = criterio.toString();//  ww w . j  a  v a2s  .  c  o m
        order += StringUtils.isBlank(token) ? "" : COMA + token;
    }
    order = StringUtils.removeStart(order, COMA);
    return StringUtils.trimToNull(order);
}