code: public static String[] split(String input, char delimiter){
          if(input == null) throw new NullPointerException("input cannot be null");
  
          final int len = input.length();
          
          // find the number of strings to split into
          int nSplits = 1;
          for (int i = 0; i < len; i++) {
              if (input.charAt(i) == delimiter) {
                  nSplits++;
              }
          }
  
          // do the actual splitting
          String[] result = new String[nSplits];
          int lastMark = 0;
          int lastSplit = 0;
          for (int i = 0; i < len; i++) {
              if (input.charAt(i) == delimiter) {
                  result[lastSplit] = input.substring(lastMark, i);
                  lastSplit++;
                  lastMark = i + 1;// 1 == delimiter length
              }
          }
          result[lastSplit] = input.substring(lastMark, len);
  
          return result;
      }
docs: Splits a string into an array using a provided delimiter. The split chunks are also trimmed.
  
  @param input string to split.
  @param delimiter  delimiter
  @return a string into an array using a provided delimiter