code: public static String[] split(String str, String delim) {
          if (isEmpty(str)) {
              return new String[0];
          }
          int cnt = search(str, delim);
          String[] item = new String[cnt + 1];
          if (cnt == 0) {
              item[0] = str;
              return item;
          }
          int idx = 0;
          int pos1 = 0;
          int pos2 = str.indexOf(delim);
          int delimLen = delim.length();
          while (pos2 >= 0) {
              item[idx++] = (pos1 > pos2 - 1) ? EMPTY : str.substring(pos1, pos2);
  
              pos1 = pos2 + delimLen;
              pos2 = str.indexOf(delim, pos1);
          }
          if (pos1 < str.length()) {
              item[idx] = str.substring(pos1);
          }
          if (item[cnt] == null) {
              item[cnt] = EMPTY;
          }
          return item;
      }
docs: Returns an array of strings separated by the delimiter string.
  
  @param str the string to be separated
  @param delim the delimiter
  @return an array, containing the splitted strings