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

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

Introduction

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

Prototype

String EMPTY

To view the source code for org.apache.commons.lang3 StringUtils EMPTY.

Click Source Link

Document

The empty String "" .

Usage

From source file:com.fengduo.bee.commons.core.lang.Argument.java

/**
 * ???/*from w  ww .  j  a  v a2 s.  c  o m*/
 * 
 * @param s
 * @return
 */
public static boolean isEmpty(String s) {
    if (null == s || StringUtils.EMPTY.equals(s) || StringUtils.EMPTY.equals(s.trim())
            || "null".equalsIgnoreCase(s)) {
        return true;
    } else {
        return false;
    }
}

From source file:io.cloudslang.lang.entities.utils.ValueUtils.java

public static boolean isEmpty(Value value) {
    return value == null || value.get() == null || StringUtils.EMPTY.equals(value.get());
}

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;
    }/* ww  w  .j a v a 2s  .c  o m*/
    String result = name.replaceAll("[^a-zA-Z0-9]", " ").replaceAll(" +", " ").trim().toUpperCase();

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

From source file:de.micromata.genome.util.strings.MiscStringUtils.java

/**
 * Shorten a String from the left side//from  w w  w  .j  ava 2s .  c o m
 * 
 * @param s the string
 * @param maxLength the max length of the string
 * @return the cutted string
 */
public static String cutLeft(String s, int maxLength) {
    if (s == null)
        return StringUtils.EMPTY;
    if (s.length() <= maxLength)
        return s;
    return s.substring(s.length() - maxLength);
}

From source file:dtu.ds.warnme.app.utils.SecurityUtils.java

public static String hashMD5Base64(String stringToHash) {
    if (StringUtils.isEmpty(stringToHash)) {
        return StringUtils.EMPTY;
    }//from  ww  w  .jav  a  2  s .com
    try {
        byte[] bytes = stringToHash.getBytes(CHARSET_UTF8);
        byte[] sha512bytes = DigestUtils.md5(bytes);
        byte[] base64bytes = Base64.encodeBase64(sha512bytes);
        return new String(base64bytes, CHARSET_UTF8);
    } catch (UnsupportedEncodingException e) {
        Log.e(TAG, "This system does not support required hashing algorithms.", e);
        throw new IllegalStateException("This system does not support required hashing algorithms.", e);
    }
}

From source file:com.astamuse.asta4d.util.i18n.LocalizeUtil.java

public static String[] getCandidatePaths(String path, Locale locale) {
    int dotIndex = path.lastIndexOf(".");
    String name = dotIndex > 0 ? path.substring(0, dotIndex) : path;
    String extension = dotIndex > 0 ? path.substring(dotIndex) : StringUtils.EMPTY;
    List<String> candidatePathList = new ArrayList<>();
    if (!StringUtils.isEmpty(locale.getVariant())) {
        candidatePathList.add(name + '_' + locale.getLanguage() + "_" + locale.getCountry() + "_"
                + locale.getVariant() + extension);
    }//  w  w w. j a va  2s . c o m
    if (!StringUtils.isEmpty(locale.getCountry())) {
        candidatePathList.add(name + '_' + locale.getLanguage() + "_" + locale.getCountry() + extension);
    }
    if (!StringUtils.isEmpty(locale.getLanguage())) {
        candidatePathList.add(name + '_' + locale.getLanguage() + extension);
    }
    candidatePathList.add(path);
    return candidatePathList.toArray(new String[candidatePathList.size()]);
}

From source file:io.github.swagger2markup.internal.utils.MarkupDocBuilderUtils.java

public static String literalText(MarkupDocBuilder markupDocBuilder, String text) {
    if (StringUtils.isBlank(text)) {
        return StringUtils.EMPTY;
    }//  w  w  w .j  a  v a 2s .  com
    return copyMarkupDocBuilder(markupDocBuilder).literalText(text).toString();
}

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

/**
 * To double.//from   w w w.  j a va2s . c om
 *
 * @param o the o
 * @return the double
 */
public static double toDouble(Object o) {
    if (o instanceof Number) {
        return ((Number) o).doubleValue();
    }
    if (o instanceof String) {
        return Double.parseDouble((String) o);
    }
    throw new RuntimeException("Cannot coerce value to double: " + Objects.toString(o, StringUtils.EMPTY));
}

From source file:com.twosigma.beaker.shared.module.util.ControlCharacterUtils.java

public static String escapeControlCharacters(final String value) {
    if (StringUtils.isNotEmpty(value)) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < value.length(); i++) {
            if (Character.isISOControl(value.charAt(i))) {
                sb.append(StringEscapeUtils.escapeJson(value.substring(i, i + 1)));
            } else {
                sb.append(value.charAt(i));
            }/*from  w ww .java 2 s  .  c o  m*/
        }
        return sb.toString();
    }
    return StringUtils.EMPTY;
}

From source file:gobblin.util.DatasetFilterUtils.java

public static List<Pattern> getPatternList(State state, String propKey) {
    return getPatternList(state, propKey, StringUtils.EMPTY);
}