code: public int divide(char separator, Text[] parts) {
          int pointer = pos;
          int limit = pos + len;
          int mark = pointer;
          int count = 0;
          
          while (pointer < limit) {
              if (chars[pointer] == separator) {
                  parts[count].strain(chars, mark, pointer - mark);
                  mark = pointer + 1;
                  count++;
                  
                  if (count == parts.length - 1) {
                      break;
                  }
              }
              pointer++;
          }
          
          if(limit > mark)
          {
          	parts[count].strain(chars, mark, limit - mark);
          	count++;
          }
          
          return count;
      }
docs: Divides text into parts using given separator and writes results
  into the parts array.
  
  @param separator the character used for splitting
  @param parts the array used to hold parts of the text
  @return the number of parts.