Java String Clean cleanString(String field)

Here you can find the source of cleanString(String field)

Description

clean String

License

Open Source License

Parameter

Parameter Description
field a parameter

Return

new string

Declaration

public static String cleanString(String field) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from  w ww  .  j  av a  2 s .  c om*/
     * @param field
     * @return new string
     */
    public static String cleanString(String field) {
        if (field == null)
            return null;
        String cleanString = field.trim();
        if (cleanString.equalsIgnoreCase(""))
            return null;
        if (cleanString.equalsIgnoreCase("NULL"))
            return null;
        if (cleanString != null && cleanString.length() == 0)
            return null;
        return cleanString;
    }
}

Related

  1. cleanString(String aString)
  2. cleanString(String input, char ol, char ne)
  3. cleanString(String statement)
  4. cleanString(String unallowableCharacters, String stringToClean)
  5. cleanStringArrayChar(String value)