code: public static String substringBefore(String str, String separator) {
      if (isEmpty(str) || separator == null) { return str; }
      if (separator.length() == 0) { return Empty; }
      int pos = str.indexOf(separator);
      if (pos == Index_not_found) { return str; }
      return str.substring(0, pos);
    }
docs: <p>
  Gets the substring before the first occurrence of a separator. The separator is not returned.
  </p>
  <p>
  A {@code null} string input will return {@code null}. An empty ("") string input will return
  the empty string. A {@code null} separator will return the input string.
  </p>
  <p>
  If nothing is found, the string input is returned.
  </p>
  
  <pre>
  substringBefore(null, *)      = null
  substringBefore("", *)        = ""
  substringBefore("abc", "a")   = ""
  substringBefore("abcba", "b") = "a"
  substringBefore("abc", "c")   = "ab"
  substringBefore("abc", "d")   = "abc"
  substringBefore("abc", "")    = ""
  substringBefore("abc", null)  = "abc"
  </pre>
  
  @param str the String to get a substring from, may be null
  @param separator the String to search for, may be null
  @return the substring before the first occurrence of the separator, {@code null} if null String
  input
  @since 2.0