Return fallback if first string is null or empty
180208
public static String defaultString(final String str, final String fallback) {
        return isNullOrEmpty(str) ? fallback : str;
    }
1326499
public static boolean isNullOrEmpty(@Nullable String string)
  {
    if (string == null || string.isEmpty())
    {
      return true;
    }
    return false;
  }
1106509
function first(arr, fn) {
  const l = arr.length;
  for (let i = 0; i < l; i += 1) {
    const res = fn(arr[i], i);
    if (res) {
      return res;
    }
  }

  return null;
}
968454
function () {
        var value = this.valueOf();

        // returns empty string if the value is
        // null or undefined or does not implement a toString
        return (!_.isNil(value) && _.isFunction(value.toString)) ? value.toString() : E;
    }
1286858
public static Opt<String> getNonEmptyString(String str) {
        return Opt.ofNullable(emptyToNull(str.trim()));
    }
316314
private static String blankToNull(String value) {
		if (value != null) {
			value = value.trim();
			if (value.equals("")) {
				value = null;
			}
		}
		return value;
	}
215830
def nullval(cls):
        """"""

        d = dict(cls.__dict__.items())

        for k in d:
            d[k] = 0

        d['sl'] = cls.sl
        d[cls.level] = 0

        return cls(**d)
265437
private String ifNull(){

        if(params.length != 2){
            throw new IllegalArgumentException("Wrong number of Parameters for if null expression");
        }

        final String field1 = record.getValueByFieldName(params[0]);
        if (!field1.isEmpty()){
            return field1;
        }
        final String field2 = record.getValueByFieldName(params[1]);
        return field2;
    }
601941
public static String nullIfEmpty(String s) {
      if (s != null && s.length() == 0) {
         return null;
      } else {
         return s;
      }
   }
1226840
def read_null_terminated_string(f):
    
    x = bytearray()
    while True:
        z = f.read(1)
        if ord(z) == 0:
            return x
        else:
            x.append(ord(z))
563023
public static String getIfNotNull(EntityColumn column, String contents, boolean empty) {
        return getIfNotNull(null, column, contents, empty);
    }
645572
protected static String turnNullClass2EmptyString(Class<?> cls, String NullDefaultStr)
    {
        return (cls == null) ? NullDefaultStr : cls.toString();
    }
1251804
public String optString(String name, String fallback) {
		Object object = opt(name);
		String result = JSON.toString(object);
		return result != null ? result : fallback;
	}
213048
private static <T> T firstNotNull(T o1, T o2) {

        if (o1 != null) {
            return o1;
        }
        return o2;
    }
1119889
private <T> T nullableWithFallback(final T first, final T second) {
    return first != null ? first : second;
  }
362807
private static String checkForEmptyString(String s) {
        if (s == null) return null;
        if (s.length() == 0) return null;

        return s;
    }
1111865
public static String nullIfEmpty(String value) {
		return value==null || value.isEmpty() ? null : value;
	}