code: protected static String substringBefore(String str, String separator) {
          if (isEmpty(str) || separator == null) {
              return null;
          }
  
          if (separator.length() == 0) {
              return "";
          }
  
          int separatorIndex = str.indexOf(separator);
          if (separatorIndex == -1) {
              return str;
          }
          return str.substring(0, separatorIndex);
      }
docs: Return the subset of the given <code>str</code> that is before the first
  occurence of the given <code>separator</code>. Return <code>null</code>
  if the given <code>str</code> or the given <code>separator</code> is
  null. Return and empty string if the <code>separator</code> is empty.
  
  @param str
  can be <code>null</code>
  @param separator
  can be <code>null</code>
  @return