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

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

Introduction

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

Prototype

public static String trimToEmpty(final 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:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the soc158PlacementCode
 */
public String getSoc158PlacementCode() {
    return StringUtils.trimToEmpty(soc158PlacementCode);
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the soc158SealedClientIndicator
 */
@Override
public String getSoc158SealedClientIndicator() {
    return StringUtils.trimToEmpty(soc158SealedClientIndicator);
}

From source file:com.simpligility.maven.plugins.android.AbstractInstrumentationMojo.java

/**
 * Helper method to build a comma separated string from a list.
 * Blank strings are filtered out//from  w  w  w . j ava  2s  .c o m
 *
 * @param lines A list of strings
 * @return Comma separated String from given list
 */
protected static String buildCommaSeparatedString(List<String> lines) {
    if (lines == null || lines.size() == 0) {
        return null;
    }

    List<String> strings = new ArrayList<String>(lines.size());
    for (String str : lines) { // filter out blank strings
        if (StringUtils.isNotBlank(str)) {
            strings.add(StringUtils.trimToEmpty(str));
        }
    }

    return StringUtils.join(strings, ",");
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the socialSecurityNumChangedCode
 */
public String getSocialSecurityNumChangedCode() {
    return StringUtils.trimToEmpty(socialSecurityNumChangedCode);
}

From source file:ml.shifu.shifu.core.dtrain.DTrainUtils.java

/**
 * Get Integer property value from map.//from  ww w.jav a  2 s  .  com
 * If the value doesn't exist in the Map or the format is incorrect, use @defval as default
 * 
 * @param params
 *            input Map
 * @param key
 *            the key to look up
 * @param defval
 *            default value, if the key is not in the map or the value format is illegal
 * @return
 *         Integer value if the key exists and value format is correct
 *         or defval
 */
@SuppressWarnings("rawtypes")
public static Integer getInt(Map params, String key, Integer defval) {
    Integer val = defval;
    if (MapUtils.isNotEmpty(params) && params.containsKey(key)) {
        Object obj = params.get(key);
        if (obj != null) {
            try {
                val = Integer.valueOf(StringUtils.trimToEmpty(obj.toString()));
            } catch (Exception e) {
                LOG.warn("Export int value for {} in params, but got {}", key, obj, e);
            }
        }
    }
    return val;
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the socialSecurityNumber
 */
public String getSocialSecurityNumber() {
    return StringUtils.trimToEmpty(socialSecurityNumber);
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the suffixTitleDescription
 */
public String getSuffixTitleDescription() {
    return StringUtils.trimToEmpty(suffixTitleDescription);
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the tribalAncestryClientIndicatorVar
 */
public String getTribalAncestryClientIndicatorVar() {
    return StringUtils.trimToEmpty(tribalAncestryClientIndicatorVar);
}

From source file:com.github.binlee1990.spider.movie.spider.MovieCrawler.java

private int getFilmLength(String value) {
    int length = 0;
    if (value.contains("")) {
        String lengthStr = StringUtils.trimToEmpty(value.substring(0, value.indexOf("")));
        if (StringUtils.isNotBlank(lengthStr)) {
            try {
                length = Integer.parseInt(lengthStr);
            } catch (Exception e) {
            }/*w w w  . java 2 s. c o  m*/
        }
    } else {
        try {
            length = Integer.parseInt(StringUtils.trimToEmpty(value));
        } catch (Exception e) {
        }
    }
    if (length < 0) {
        length = 0;
    }
    return length;
}

From source file:net.community.chest.gitcloud.facade.frontend.git.GitController.java

private Map<String, String> copyRequestHeadersValues(HttpServletRequest req, HttpRequestBase request) {
    Map<String, String> hdrsMap = ServletUtils.getRequestHeaders(req);
    for (Map.Entry<String, String> hdrEntry : hdrsMap.entrySet()) {
        String hdrName = hdrEntry.getKey(), hdrValue = StringUtils.trimToEmpty(hdrEntry.getValue());
        if (StringUtils.isEmpty(hdrValue)) {
            logger.warn("copyRequestHeadersValues(" + req.getMethod() + ")[" + req.getRequestURI() + "]["
                    + req.getQueryString() + "]" + " no value for header " + hdrName);

        }// ww w  . j a v  a 2 s  .  c o m

        if (FILTERED_REQUEST_HEADERS.contains(hdrName)) {
            if (logger.isTraceEnabled()) {
                logger.trace("copyRequestHeadersValues(" + req.getMethod() + ")[" + req.getRequestURI() + "]["
                        + req.getQueryString() + "]" + " filtered " + hdrName + ": " + hdrValue);
            }
        } else {
            if (logger.isTraceEnabled()) {
                logger.trace("copyRequestHeadersValues(" + req.getMethod() + ")[" + req.getRequestURI() + "]["
                        + req.getQueryString() + "]" + " " + hdrName + ": " + hdrValue);
            }
            request.addHeader(hdrName, hdrValue);
        }

        hdrsMap.put(hdrName, hdrValue);
    }

    return hdrsMap;
}