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 adjudicatedDelinquentIndicator
 */
public String getAdjudicatedDelinquentIndicator() {
    return StringUtils.trimToEmpty(adjudicatedDelinquentIndicator);
}

From source file:de.micromata.genome.util.types.Converter.java

/**
 * Normalize number string.// ww  w  .j  a v  a 2 s  .c  o m
 *
 * @param source the source
 * @param exp10 the exp10
 * @param scale the scale
 * @param decimalChar the decimal char
 * @param unit the unit
 * @return the string
 */
public static String normalizeNumberString(String source, int exp10, int scale, char decimalChar, String unit) {
    source = StringUtils.trimToEmpty(source);
    if (StringUtils.isEmpty(source) == true) {
        return "";
    }
    return buildNormalizedNumberString(new BigDecimal(source.replace(',', '.')), exp10, scale, decimalChar,
            unit);
}

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

/**
 * @return the adoptionStatusCode
 */
public String getAdoptionStatusCode() {
    return StringUtils.trimToEmpty(adoptionStatusCode);
}

From source file:com.omertron.slackbot.listeners.BoardGameListener.java

/**
 * Send out a welcome message./* w w w. ja  va  2s .c o m*/
 *
 * @param params
 * @param session
 * @param channel
 */
private void adminWelcome(String params, SlackSession session, SlackChannel channel) {
    String user = StringUtils.trimToEmpty(params);
    if ("WHO".equalsIgnoreCase(user)) {
        BotWelcome.listUsers(session, channel);
        return;
    }

    SlackUser slackUser = session.findUserByUserName(user);
    if (slackUser == null) {
        session.sendMessage(channel, String.format("No user with username '%1$s' found", user));
    } else {
        session.sendMessage(channel, "Sending welcome message to " + slackUser.getUserName());
        BotWelcome.sendWelcomeMessage(session, channel, slackUser);
    }
}

From source file:com.orange.ocara.ui.activity.EditAuditActivity.java

protected void setName(String name) {
    this.name.setText(StringUtils.trimToEmpty(name));
}

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

private void setFilmReviewImdbGrade(Document doc, FilmReview filmReview) {
    Elements imdbElements = doc.select(".fm-title .fm-orange");
    if (CollectionUtils.isNotEmpty(imdbElements) && imdbElements.size() == 1) {
        Element imdbElement = imdbElements.get(0);
        if (null != imdbElement) {
            String imdbGradeStr = imdbElement.text();
            if (StringUtils.isNotBlank(imdbGradeStr) && StringUtils.contains(imdbGradeStr, "IMDB")) {
                String gradeStr = StringUtils
                        .trimToEmpty(imdbGradeStr.substring(imdbGradeStr.indexOf("IMDB") + "IMDB".length()));
                if (StringUtils.isNotBlank(gradeStr)) {
                    float grade = getGrade(gradeStr);
                    filmReview.setGradeDouban(grade);
                }/*  w ww. ja  v  a 2  s  .  c om*/
            }
        }
    }
}

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

/**
 * @return the alienRegistrationNumber
 */
public String getAlienRegistrationNumber() {
    return StringUtils.trimToEmpty(alienRegistrationNumber);
}

From source file:com.open.cas.shiro.util.CollectionsUtils.java

public static String[] clean(String[] arr) {
    if (!isEmpty(arr)) {
        List<String> list = new ArrayList<String>();
        for (String string : arr) {
            String trim = StringUtils.trimToEmpty(string);
            if (StringUtils.isNotEmpty(trim)) {
                list.add(trim);//from w  w w  . j  a  va  2  s .c om
            }
        }
        return list.toArray(new String[0]);
    }
    return new String[0];
}

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

/**
 * @return the birthCity
 */
public String getBirthCity() {
    return StringUtils.trimToEmpty(birthCity);
}

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

/**
 * @return the birthFacilityName
 */
public String getBirthFacilityName() {
    return StringUtils.trimToEmpty(birthFacilityName);
}