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

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

Introduction

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

Prototype

public static boolean isEmpty(String str) 

Source Link

Document

Checks if a String is empty ("") or null.

Usage

From source file:net.duckling.ddl.util.PictureCheckCodeUtil.java

/**
 * ?request?????????//from   w  ww. j av a  2  s.  co  m
 * @param request
 * @param code
 * @param type
 * @param reflesh true typesession??false?
 * @return
 */
public static boolean checkCode(HttpServletRequest request, String code, String type, boolean reflesh) {
    if (StringUtils.isEmpty(type) || StringUtils.isEmpty(code)) {
        return false;
    }
    String c = (String) request.getSession().getAttribute(type);
    if (!StringUtils.isEmpty(c) && c.equalsIgnoreCase(code)) {
        if (reflesh) {
            request.getSession().removeAttribute(type);
        }
        return true;
    } else {
        request.getSession().removeAttribute(type);
        return false;
    }

}

From source file:com.fengduo.bee.search.utils.PinyinParser.java

public static Set<String> converter2AllSpell(String chines) {
    if (StringUtils.isEmpty(chines)) {
        return Collections.<String>emptySet();
    }//  ww w. j a v  a2s  .c  o  m
    StringBuffer pinyinName = new StringBuffer();
    char[] nameChar = chines.toCharArray();
    HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
    defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
    defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    for (int i = 0; i < nameChar.length; i++) {
        if (nameChar[i] > 128) {
            try {
                // ??
                String[] strs = PinyinHelper.toHanyuPinyinStringArray(nameChar[i], defaultFormat);
                if (strs != null) {
                    pinyinName.append(StringUtils.join(strs, ","));
                }
            } catch (BadHanyuPinyinOutputFormatCombination e) {
                e.printStackTrace();
            }

        } else {
            pinyinName.append(nameChar[i]);
        }
        pinyinName.append(" ");
    }
    return parseTheChineseByObject(discountTheChinese(pinyinName.toString()));

}

From source file:eu.europa.esig.dss.applet.util.DSSStringUtils.java

/**
 *
 * @param source/*w  w  w.j a v  a2  s  .co  m*/
 * @param values
 * @return
 */
public static boolean contains(final String source, final String... values) {

    if (StringUtils.isEmpty(source)) {
        return false;
    }

    for (final String value : values) {
        if (source.equals(value)) {
            return true;
        }
    }

    return false;
}

From source file:com.infullmobile.jenkins.plugin.restrictedregister.util.Utils.java

@SuppressWarnings("WeakerAccess")
public static boolean isAnyStringEmpty(String... values) {
    for (String entry : values) {
        if (StringUtils.isEmpty(entry)) {
            return true;
        }/* www . j  av a 2  s. c  o  m*/
    }
    return false;
}

From source file:com.baifendian.swordfish.common.utils.CommonUtil.java

/**
 * ???/*from   w w w .ja v a 2s.c om*/
 */
public static String fileSuffix(String filename) {
    if (StringUtils.isEmpty(filename)) {
        return StringUtils.EMPTY;
    }

    int index = filename.lastIndexOf(".");
    if (index < 0) {
        return StringUtils.EMPTY;
    }

    return filename.substring(index + 1);
}

From source file:com.mmj.app.biz.cons.TopicOrderTimeEnum.java

/**
 * ?name?//from   w  w  w .j  a  v a 2s  .c o m
 */
public static TopicOrderTimeEnum getEnum(String name) {
    if (StringUtils.isEmpty(name)) {
        return null;
    }
    for (TopicOrderTimeEnum current : values()) {
        if (StringUtils.equalsIgnoreCase(current.name, name)) {
            return current;
        }
    }
    return null;
}

From source file:com.baidu.rigel.biplatform.tesseract.util.TesseractResultSetUtil.java

/**
 * /*w ww . j  a va2 s .co  m*/
 * getQueryMeasureFieldName getQueryMeasureFieldName
 * 
 * @param measure
 *            measure
 * @param aggregator
 *            aggregator
 * @return String
 */
public static String getQueryMeasureFieldName(String measure, Aggregator aggregator) {
    if (!StringUtils.isEmpty(measure) && aggregator != null && !StringUtils.isEmpty(aggregator.name())) {
        return measure + PROPERTYKEY_CONN_STR + aggregator.name();
    }
    return null;
}

From source file:com.zb.app.biz.cons.GuestAgeTypeEnum.java

public static GuestAgeTypeEnum getAction(String name) {
    if (StringUtils.isEmpty(name)) {
        return null;
    }/*from  w w  w .j av  a  2s  .c  om*/
    for (GuestAgeTypeEnum type : values()) {
        if (StringUtils.equals(name, type.name))
            return type;
    }
    return null;
}

From source file:AIR.Common.Web.WebHelper.java

public static long getQueryValueLong(String name) {
    String value = getQueryString(name);
    if (StringUtils.isEmpty(value))
        return 0;
    return Long.parseLong(value);
}

From source file:com.cy.dctms.common.util.ValidateUtil.java

/**
 * ? ????57188175786?/*from  w  ww  .j  a  v  a 2  s  .  co  m*/
 * @return false:?; true:?
 * */
public static boolean validatePhonees(String telephone) {
    if (StringUtils.isEmpty(telephone)) {
        return false;
    }
    Pattern pattern = Pattern.compile("^((0\\d{2,3}))(\\d{7,8})(-(\\d{3,}))?$");
    Matcher macher = pattern.matcher(telephone);
    return macher.matches();
}