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

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

Introduction

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

Prototype

public static String trimToEmpty(String str) 

Source Link

Document

Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null.

Usage

From source file:net.di2e.ecdr.commons.util.SearchUtils.java

public static Map<String, String> convertToMap(List<String> mapList) {
    Map<String, String> inputMap = new HashMap<>();
    if (CollectionUtils.isNotEmpty(mapList)) {
        for (String sortPair : mapList) {
            String[] pairAry = sortPair.split(MAP_ENTRY_DELIMITER);
            if (pairAry.length == 2) {
                inputMap.put(StringUtils.trimToEmpty(pairAry[0]), StringUtils.trimToEmpty(pairAry[1]));
            } else {
                LOGGER.warn("Could not parse out map entry from {}, skipping this item.", sortPair);
            }/*from   w w w  .  j  a  va  2 s.  c  o  m*/
        }
    }
    return inputMap;
}

From source file:com.prowidesoftware.swift.model.field.Field29L.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *//*from   ww w  .  j  a v a 2s.com*/
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(StringUtils.trimToEmpty(getComponent1()));
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent2()));
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent3()));
    return result.toString();
}

From source file:com.hangum.tadpole.rdb.core.dialog.export.sqltoapplication.application.SQLToMyBatisConvert.java

/**
 * make some sql/*from  ww  w . j  a  v a2  s . c o m*/
 * @param sql
 * @return
 */
private static String makeSomeSQL(String sql) {
    StringBuffer sbSQL = new StringBuffer();
    StringBuffer strLine;
    StringBuffer strConst;

    sql = StringUtils.remove(sql, ";");
    String[] splists = StringUtils.split(sql, PublicTadpoleDefine.LINE_SEPARATOR);
    int idx = 1;
    for (String part : splists) {

        if (!"".equals(StringUtils.trimToEmpty(part))) {

            sbSQL.append("\t");
            part = SQLTextUtil.delLineChar(part);
            strLine = new StringBuffer();
            strConst = new StringBuffer();
            boolean isOpen = false;
            for (int p = 0; p < part.length(); p++) {

                if (!isOpen & '\'' == part.charAt(p)) {
                    strLine.append("#{");
                    strConst.append("/* '");
                    isOpen = true;
                } else if (isOpen & '\'' == part.charAt(p)) {
                    strLine.append("param_" + idx++ + "}");
                    strConst.append("' */");
                    isOpen = false;
                } else if (!isOpen) {
                    strLine.append(part.charAt(p));
                } else if (isOpen) {
                    strConst.append(part.charAt(p));
                }
            }
            sbSQL.append(strLine.toString() + strConst.toString());
            sbSQL.append(PublicTadpoleDefine.LINE_SEPARATOR);
        } //if Empty
    } //for

    return sbSQL.toString();
}

From source file:nc.noumea.mairie.appock.entity.Adresse.java

/**
 * @return le libell sur une ligne, sans retour  la ligne, de l'adresse
 *//*  w ww  .j a v  a  2s  .  c  o  m*/
@Override
public String getLibelleCourt() {
    List<String> listeChampRetenu = new ArrayList<>();
    if (numVoie != null) {
        listeChampRetenu.add(String.valueOf(numVoie));
    }
    for (String champ : new String[] { complementNumVoie, voie, pointRemise, complement, lotissement, quartier,
            getBpAvecPrefixeBp(), cp, ville }) {
        if (!StringUtils.isBlank(champ)) {
            listeChampRetenu.add(StringUtils.trimToEmpty(champ));
        }
    }
    return StringUtils.join(listeChampRetenu, " ");
}

From source file:com.prowidesoftware.swift.model.field.Field31B.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *///from www  .j a  va  2  s . com
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(StringUtils.trimToEmpty(getComponent1()));
    appendInLines(result, getComponent2(), getComponent3(), getComponent4(), getComponent5());
    return result.toString();
}

From source file:com.prowidesoftware.swift.model.field.Field12A.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *//*from  w w  w . j a  v  a2 s .c  o  m*/
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(":");
    result.append(StringUtils.trimToEmpty(getComponent1()));
    result.append("/");
    if (StringUtils.isNotEmpty(getComponent2())) {
        result.append(StringUtils.trimToEmpty(getComponent2()));
    }
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent3()));
    return result.toString();
}

From source file:com.prowidesoftware.swift.model.field.Field35U.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 */// www .  j a  v  a  2s  .  c  o m
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append(StringUtils.trimToEmpty(getComponent1()));
    result.append(StringUtils.trimToEmpty(getComponent2()));
    if (org.apache.commons.lang.StringUtils.isNotEmpty(getComponent3())) {
        result.append(StringUtils.trimToEmpty(getComponent3()));
    }
    return result.toString();
}

From source file:com.hangum.tadpole.rdb.core.dialog.dbconnect.AbstractLoginComposite.java

/**
 * text message//from   w ww. j av a 2  s.  co  m
 * 
 * @param text
 * @param msg
 * @return
 */
protected boolean message(Text text, String msg) {
    if ("".equals(StringUtils.trimToEmpty(text.getText()))) { //$NON-NLS-1$
        MessageDialog.openError(null, Messages.DBLoginDialog_10, msg + Messages.MySQLLoginComposite_10);
        text.setFocus();

        return false;
    }

    return true;
}

From source file:com.prowidesoftware.swift.model.field.Field50G.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *///from  www . j a v a  2 s.  c  om
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent1()));
    if (StringUtils.isNotEmpty(getComponent2())) {
        result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL);
        result.append(StringUtils.trimToEmpty(getComponent2()));
    }
    return result.toString();
}

From source file:com.prowidesoftware.swift.model.field.Field130.java

/**
 * Serializes the fields' components into the single string value (SWIFT format)
 *///  w w w  .j a va  2s.c  om
@Override
public String getValue() {
    final StringBuilder result = new StringBuilder();
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent1()));
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent2()));
    result.append(com.prowidesoftware.swift.io.writer.FINWriterVisitor.SWIFT_EOL);
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent3()));
    result.append("/");
    result.append(StringUtils.trimToEmpty(getComponent4()));
    return result.toString();
}