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

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

Introduction

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

Prototype

public static String[] splitByWholeSeparator(final String str, final String separator) 

Source Link

Document

Splits the provided text into an array, separator string specified.

The separator(s) will not be included in the returned String array.

Usage

From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.ValidadorFormato.java

public static String completarFloat(float numero, int entero, int decimales) {
    String numeroTxt = numero + "";
    String enteroTxt = StringUtils.splitByWholeSeparator(numeroTxt, ".")[0];
    String decimalTxt = StringUtils.splitByWholeSeparator(numeroTxt, ".")[1];
    enteroTxt = StringUtils.leftPad(enteroTxt, entero, "0");
    decimalTxt = StringUtils.rightPad(enteroTxt, entero, "0");
    return enteroTxt + decimalTxt;

}

From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.ValidadorFormato.java

public static String completarFloat(String numero, int entero, int decimales) {
    String numeroTxt = numero + "";
    String enteroTxt = StringUtils.splitByWholeSeparator(numeroTxt, ".")[0];
    String decimalTxt = StringUtils.splitByWholeSeparator(numeroTxt, ".")[1];
    enteroTxt = StringUtils.leftPad(enteroTxt, entero, "0");
    decimalTxt = StringUtils.rightPad(decimalTxt, decimales, "0");
    return enteroTxt + decimalTxt;

}

From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.ValidadorFormato.java

public static String completarEntero(String numero, int longitud) {
    String numeroTxt = numero + "";
    String enteroTxt = StringUtils.splitByWholeSeparator(numeroTxt, ".")[0];
    enteroTxt = StringUtils.leftPad(enteroTxt, longitud, "0");
    return enteroTxt;

}

From source file:kenh.expl.functions.SplitByWholeSeparator.java

public String[] process(String str) {
    return StringUtils.splitByWholeSeparator(str, null);
}

From source file:kenh.expl.functions.SplitByWholeSeparator.java

public String[] process(String str, String separator) {
    return StringUtils.splitByWholeSeparator(str, separator);
}

From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.tipoDato.TextV.java

@Override
public String[] getDato() {
    return StringUtils.splitByWholeSeparator(trama, limitador);
}

From source file:de.blizzy.documentr.markdown.macro.impl.TabMacro.java

static List<TabData> getTabs(String s) {
    String[] parts = StringUtils.splitByWholeSeparator(s, TAB_START_MARKER);
    List<TabData> tabs = Lists.newArrayList();
    for (String part : parts) {
        part = StringUtils.removeEnd(part, TAB_END_MARKER);
        if (StringUtils.isNotBlank(part)) {
            TabData tabData = TabData.deserialize(part);
            tabs.add(tabData);/*from   www.java  2 s . c o  m*/
        }
    }
    return tabs;
}

From source file:com.netflix.genie.web.data.utils.H2Utils.java

/**
 * Split the existing command executable on any whitespace characters and insert them into the
 * {@code command_executable_arguments} table in order.
 * <p>/*  ww  w.  j  av  a2  s  .  co  m*/
 * See: {@code src/main/resources/db/migration/h2/V4_0_0__Genie_4.sql} for usage
 *
 * @param con The database connection to use
 * @throws Exception On Error
 */
public static void splitV3CommandExecutableForV4(final Connection con) throws Exception {
    try (PreparedStatement commandsQuery = con.prepareStatement(V3_COMMAND_EXECUTABLE_QUERY);
            PreparedStatement insertCommandArgument = con.prepareStatement(V4_COMMAND_ARGUMENT_SQL);
            ResultSet rs = commandsQuery.executeQuery()) {
        while (rs.next()) {
            final long commandId = rs.getLong(V3_COMMAND_ID_INDEX);
            final String executable = rs.getString(V3_COMMAND_EXECUTABLE_INDEX);
            final String[] arguments = StringUtils.splitByWholeSeparator(executable, null);
            if (arguments.length > 0) {
                insertCommandArgument.setLong(V4_COMMAND_ID_INDEX, commandId);
                for (int i = 0; i < arguments.length; i++) {
                    insertCommandArgument.setString(V4_COMMAND_ARGUMENT_INDEX, arguments[i]);
                    insertCommandArgument.setInt(V4_COMMAND_ARGUMENT_ORDER_INDEX, i);
                    insertCommandArgument.executeUpdate();
                }
            }
        }
    }
}

From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.tipoDato.TextV.java

@Override
public void setDato(String dato) {
    this.longitud = dato.length();
    String datos[] = StringUtils.splitByWholeSeparator(dato, limitador);
    for (String resultado : datos) {
        this.datos.add(resultado);
    }/*from  w w  w . j  a v  a  2 s. c  o  m*/

}

From source file:de.jcup.egradle.integration.IntegrationTestTextProvider.java

@Override
public int getLineOffset(int offset) throws TextProviderException {
    /* lines in read textfiles will always contain \n... */
    String[] lines = StringUtils.splitByWholeSeparator(text, "\n");
    if (offset == 0) {
        return 0;
    }//from ww w.  ja v  a 2 s .  com
    int linePos = 0;
    for (int i = 0; i < lines.length; i++) {
        String line = lines[i];
        int ending = linePos + line.length() + 1;// +1 because of \n was
        // removed before
        if (offset >= linePos && offset <= ending) {
            return linePos;
        }
        linePos = ending + 1;
    }
    throw new TextProviderException("Cannot determine line offset for:" + offset);
}