Android String Empty Check filterString(String string)

Here you can find the source of filterString(String string)

Description

filter String

Parameter

Parameter Description
string a parameter

Declaration

public static String filterString(String string) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from w  w  w  .ja  v a 2 s.co m
     * 
     * @param string
     * @return
     */
    public static String filterString(String string) {
        if (isEmptyOrNull(string)) {
            return "";
        }
        return string.trim();
    }

    public static boolean isEmptyOrNull(String string) {
        if (string == null) {
            return true;
        }
        if (string.trim().length() == 0) {
            return true;
        }
        return false;
    }
}

Related

  1. ckIsEmpty(String s)
  2. isEmptyOrNull(String str)
  3. isBlank(String s)
  4. isBlank(String str)
  5. isBlank(EditText editText)
  6. isBlank(String string)