Java String Empty to Null emptyToNull(String text)

Here you can find the source of emptyToNull(String text)

Description

empty To Null

License

Open Source License

Declaration

public static String emptyToNull(String text) 

Method Source Code

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

public class Main {
    public static String emptyToNull(String text) {
        if (text != null) {
            if (text.trim().isEmpty()) {
                text = null;//from ww  w .java2  s  . c o m
            }
        }
        return text;
    }
}

Related

  1. emptyToNull(String s)
  2. emptyToNull(String str)
  3. emptyToNull(String str)
  4. emptyToNull(String str)
  5. emptyToNull(String string)
  6. emptyToNull(String val)
  7. emptyToNull(String value)
  8. emptyToString(String str, String returnStr)
  9. isHtmlNull(String str)