Java Null Value Convert convertNullToString(final String str)

Here you can find the source of convertNullToString(final String str)

Description

convert Null To String

License

Apache License

Declaration

public static String convertNullToString(final String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String convertNullToString(final String str) {

        if (str == null) {
            return "";
        } else {//  w w  w.  j  av  a2 s .c om
            final int len = str.length();
            for (int i = 0; i < len; i++) {
                if (str.charAt(i) != ' ')
                    break;
            }

            return str.trim();
        }
    }
}

Related

  1. convertNullToFalse(Boolean b)
  2. convertNullToInteger(Object orgStr, int convertStr)
  3. convertNullToLong(Object orgStr, Long convertStr)
  4. convertNullToOne(final Object value)
  5. convertNullToSolrValue(String fieldName)
  6. convertNullValue(final Class convertType)
  7. null2blank(String prnStr)
  8. null2blank(String source)
  9. null2Boolean(Object expression, boolean defValue)