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

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

Introduction

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

Prototype

public static boolean isBlank(final CharSequence cs) 

Source Link

Document

Checks if a CharSequence is whitespace, empty ("") or null.

 StringUtils.isBlank(null)      = true StringUtils.isBlank("")        = true StringUtils.isBlank(" ")       = true StringUtils.isBlank("bob")     = false StringUtils.isBlank("  bob  ") = false 

Usage

From source file:mobile.util.MobileUtil.java

/**
 * ?URL?1/*from   ww  w  .ja  v a2  s . c o m*/
 * 
 * @return truefalse?
 */
public static boolean isMobileUrlPrefix(String url) {
    if (StringUtils.isBlank(url)) {
        return false;
    } else {
        return url.startsWith("/mobile/");
    }
}

From source file:net.packet.TrafficBucket.java

public static TrafficBucket fromValue(String value) {
    if (StringUtils.isBlank(value)) {
        throw new IllegalArgumentException("Value cannot be null or empty!");
    }//from  w  w w .j a va 2s .  co  m

    for (TrafficBucket tb : TrafficBucket.values()) {
        if (value.equalsIgnoreCase(tb.value)) {
            return tb;
        }
    }

    throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
}

From source file:com.alibaba.event.strategy.TriggerEventStrategyEnum.java

/**
 * //  www. jav a2s .  c  o m
 * 
 * @param value
 * @return
 */
public static TriggerEventStrategyEnum typeOf(String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }
    for (TriggerEventStrategyEnum strategy : TriggerEventStrategyEnum.values()) {
        if (strategy.getValue().equals(value)) {
            return strategy;
        }
    }
    return null;
}

From source file:ext.sns.service.ProviderType.java

public static boolean validateType(String provider, String type) {
    if (StringUtils.isBlank(provider) || !validateType(type)) {
        return false;
    }/*from   w w w  . j  av a  2s  . c  o  m*/

    ProviderConfig providerConfig = ConfigManager.getProviderConfigByName(provider);
    if (null == providerConfig) {
        return false;
    }

    return providerConfig.getTypes().contains(type);
}

From source file:ch.citux.td.util.Log.java

public static void d(String tag, String message) {
    if (!StringUtils.isBlank(tag) && !StringUtils.isBlank(message)) {
        android.util.Log.d(tag, message);
    }/* w  w  w  . ja va  2 s .c o m*/
}

From source file:learningresourcefinder.web.Slugify.java

public static String slugify(String input) {
    String ret = StringUtils.trim(input);
    if (StringUtils.isBlank(input)) {
        return "";
    }//  ww  w  . j  a  v a2 s.co  m
    ret = Jsoup.parse(ret).text(); // In case the string contains some html, such as <em>.
    ret = normalize(ret);
    ret = removeSmallWords(ret);
    ret = removeDuplicateWhiteSpaces(ret);
    ret = StringUtils.stripAccents(ret); // It seems to be bad practice to have accents in slugs:  --> e
    return ret.replace(" ", "-").toLowerCase();
}

From source file:com.creditcloud.tag.utils.TagUtils.java

/**
 * ??tagString?tag.//from w ww .jav a2 s  .c  o  m
 *
 * BRANCH:DFEF5840-78F2-4758-88C2-B670F83A44A1?INTERNAL_USER?
 * ?????REALM?STRING?
 *
 * @param tagString
 * @return
 */
public static Tag toTag(String tagString) {
    if (StringUtils.isBlank(tagString)) {
        return null;
    }
    String trimmedTagString = tagString.trim();
    int index = trimmedTagString.indexOf(TagConstant.SEPERATOR);
    if (index <= 0) {
        return new Tag(Realm.STRING, trimmedTagString, null, null);
    } else {
        try {
            Realm realm = Realm.valueOf(trimmedTagString.substring(0, index));
            int lastIndex = trimmedTagString.lastIndexOf(TagConstant.SEPERATOR);
            if (index == lastIndex) {
                return new Tag(realm, trimmedTagString.substring(index + 1), null, null);
            } else {
                return new Tag(realm, trimmedTagString.substring(index + 1, lastIndex),
                        trimmedTagString.substring(lastIndex + 1), null);
            }
        } catch (IllegalArgumentException ex) {
            return new Tag(Realm.STRING, trimmedTagString, null, null);
        }
    }
}

From source file:com.jci.azure.DataUtil.java

/**
 * Gets the continuation token.//w w  w  .j a  v  a  2s.c om
 *
 * @param param the param
 * @return the continuation token
 */
public static ResultContinuation getContinuationToken(ScrollingParam param) {
    ResultContinuation token = null;
    if (param == null) {
        return null;
    } else {
        token = new ResultContinuation();
        token.setContinuationType(ResultContinuationType.TABLE);
    }

    if (param != null && !StringUtils.isBlank(param.getPartition())) {
        token.setNextPartitionKey(param.getPartition());
    }

    if (param != null && !StringUtils.isBlank(param.getRow())) {
        token.setNextRowKey(param.getRow());
    }

    return token;
}

From source file:de.jcup.egradle.core.util.StringUtilsAccess.java

public static boolean isBlank(CharSequence cs) {
    return StringUtils.isBlank(cs);
}

From source file:com.aqnote.app.wifianalyzer.vendor.model.VendorNameUtils.java

static String cleanVendorName(String name) {
    if (StringUtils.isBlank(name) || name.contains("<") || name.contains(">")) {
        return StringUtils.EMPTY;
    }/*from w w w.ja v a  2 s. c  om*/
    String result = name.replaceAll("[^a-zA-Z0-9]", " ").replaceAll(" +", " ").trim().toUpperCase();

    return result.substring(0, Math.min(result.length(), VENDOR_NAME_MAX));
}