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:com.moviejukebox.model.Person.java

public void addAka(String alsoKnownAs) {
    String tmpAka = StringUtils.trimToEmpty(alsoKnownAs);
    if (isValidString(tmpAka) && !getName().equals(tmpAka) && !getTitle().equals(tmpAka)
            && !this.aka.contains(tmpAka)) {
        this.aka.add(tmpAka);
        setDirty();//from   w w w  .j  a v a  2s  .  c  o m
    }
}

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

/**
 * @return the caDriverLicenseNumber
 */
public String getCaDriverLicenseNumber() {
    return StringUtils.trimToEmpty(caDriverLicenseNumber);
}

From source file:com.omertron.themoviedbapi.model.Person.java

public void setDeathday(String deathday) {
    this.deathday = StringUtils.trimToEmpty(deathday);
}

From source file:com.omertron.slackbot.SlackBot.java

/**
 * Populate the list of BOT Administrators from the property file.
 *
 * @param session//from w  w  w  . ja  v  a 2  s .  co  m
 */
private static void populateBotAdmins(SlackSession session) {
    String users = PropertiesUtil.getProperty(Constants.BOT_ADMINS, "");

    if (StringUtils.isNotBlank(users)) {
        SlackUser sUser;
        for (String user : StringUtils.split(users, ",")) {
            sUser = session.findUserByUserName(StringUtils.trimToEmpty(user));
            if (sUser != null) {
                LOG.info("Adding {} ({}) to {} admins", sUser.getUserName(), sUser.getRealName(),
                        Constants.BOT_NAME);
                // Add the uername to the list
                BOT_ADMINS.add(sUser);
            } else {
                LOG.warn("Username '{}' was not found in the list of slack users!", user);
            }
        }
    }
}

From source file:com.moviejukebox.tools.GitRepositoryState.java

/**
 * Get the currently running YAMJ version
 *
 * @return/*from   w  w w .ja  va 2s  .c o m*/
 */
public static String getVersion() {
    // Populated by the manifest file
    return StringUtils.trimToEmpty(MovieJukebox.class.getPackage().getSpecificationVersion());
}

From source file:com.omertron.themoviedbapi.model.Person.java

public void setHomepage(String homepage) {
    this.homepage = StringUtils.trimToEmpty(homepage);
}

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

/**
 * @return the cityName
 */
public String getCityName() {
    return StringUtils.trimToEmpty(cityName);
}

From source file:gtu.youtube.JavaYoutubeDownloader.java

/**
 * Cookie key \t value/* w w w. j av  a  2 s . co  m*/
 */
private BasicCookieStore getCookieString(String cookieStr) {
    BasicCookieStore cookstore = new BasicCookieStore();
    BufferedReader reader = null;
    try {
        reader = new BufferedReader(new StringReader(cookieStr));
        for (String line = null; (line = reader.readLine()) != null;) {
            String[] arry = line.split("\t", -1);
            if (arry != null && arry.length == 2) {
                arry[0] = StringUtils.trimToEmpty(arry[0]);
                arry[1] = StringUtils.trimToEmpty(arry[1]);
                cookstore.addCookie(new BasicClientCookie(arry[0], arry[1]));
                System.out.println("cookie : " + Arrays.toString(arry));
            }
        }
        return cookstore;
    } catch (Exception ex) {
        throw new RuntimeException(" Err : " + ex.getMessage(), ex);
    } finally {
        try {
            reader.close();
        } catch (Exception e) {
        }
    }
}

From source file:ke.co.tawi.babblesms.server.servlet.admin.network.Addnetwork.java

/**
 * Set the class variables that represent form parameters.
 *
 * @param request//from  w ww.ja  v a2s . co  m
 */
private void setClassParameters(HttpServletRequest request) {
    networkname = StringUtils.trimToEmpty(request.getParameter("network"));
    countryuuid = StringUtils.trimToEmpty(request.getParameter("countryuuid"));

}

From source file:kenh.xscript.elements.Include.java

private void handleScript(Element element, boolean loadPublics, boolean loadMethods, String methodNames)
        throws UnsupportedScriptException {
    if (!(element instanceof Script))
        throw new UnsupportedScriptException(this,
                "The root element should be <script>. [" + element.getClass().getCanonicalName() + "]");

    methodNames = StringUtils.trimToEmpty(methodNames);
    String[] methods = StringUtils.split(methodNames, ",");

    Script s = (Script) element;/*from  w ww .  ja v a2  s  . c om*/
    String main = StringUtils.trimToEmpty(s.getMainMethod());

    Vector<Element> children = element.getChildren();
    for (Element child : children) {

        boolean isMethod = (child instanceof Method) ? true : false;

        if (loadPublics && !isMethod) {
            child.invoke();
        } else if (loadMethods && isMethod) {
            String methodName = StringUtils.trimToEmpty(((Method) child).getName());

            if (methods != null && methods.length <= 0) {
                if (!StringUtils.equals(methodName, main)) { // Skip main method
                    child.invoke();
                }
            } else {

                for (String m : methods) {
                    if (StringUtils.equals(methodName, StringUtils.trimToEmpty(m))) {
                        child.invoke();
                        break;
                    }
                }

            }

        }

    }
}