code: public static String[] split(String str, char separator) {
      final int len;
      if (str == null 
          || ((len = str.length()) == 0)) {
        return null;
      }
  
      List<String> componentList = new ArrayList<String>();
      int startIndex = 0;
  
      for (int i = 0; i < len; i++) {
        if (str.charAt(i) == separator) {
          componentList.add(str.substring(startIndex, i));
          startIndex = i + 1;
        }
      }
  
      if (str.charAt(len - 1) != separator) {
        componentList.add(str.substring(startIndex, len));
      }
  
      return componentList.toArray(new String[componentList.size()]);
    }
docs: An implementation of the String.split(String);