Splits text into partitions.

@param separator character used for partitioning
@return array of text strings.
348168
public Collection<Text> split(Text separator) {
    	ArrayList<Text> tokens = new ArrayList<Text>();
    	int pointer = pos;
        int limit = pos + len;
        int mark = pointer;
        
        if(separator.length()==0)
    	{
        	tokens.add(new Text(chars, mark, pointer - mark));
    		return tokens;
    	}
    	
        int index=0;
        while (pointer < limit) {
            if (chars[pointer] == separator.charAt(index))
                index++;
            else 
            	index=0;
                        
            if(index==separator.length())
            {
            	tokens.add(new Text(chars, mark, pointer - mark));
                mark = pointer + 1;
                index=0;
            }
            
            pointer++;                    
        }
        
        tokens.add(new Text(chars, mark, limit - mark));        
        return tokens;
    }
987956
public static String join(Collection<?> objects, String separator) {
        String result = null;

        if (objects.size() > 0) {
            for (Object object : objects) {
                if (result == null) {
                    result = object.toString();
                } else {
                    result += separator + object.toString();
                }
            }
        } else {
            result = "";
        }

        return result;
    }
498417
public static <T> String join(List<T> list, String separator) {
		StringBuilder builder = new StringBuilder();
		int i = 0;
		for (T t : list) {
			builder.append(t);
			if (++i < list.size()) builder.append(separator);
		}
		return builder.toString();
	}
813024
public static List<String> split(String string, String separator)
  {
    final int separatorLength = separator.length();
    final List<String> list = new ArrayList<String>();

    int fromIndex = 0;
    for(;;) {
      int endIndex = string.indexOf(separator, fromIndex);
      if(endIndex == -1) {
        break;
      }
      if(fromIndex < endIndex) {
        list.add(string.substring(fromIndex, endIndex).trim());
      }
      fromIndex = endIndex + separatorLength;
    }
    if(fromIndex < string.length()) {
      list.add(string.substring(fromIndex).trim());
    }
    return list;
  }
1168610
def split(text: str) -> List[str]:
    
    return [word for word in SEPARATOR.split(text) if word.strip(' \t')]
256702
public static String join(String separator, List<String> topicsArray) {

    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < topicsArray.size(); i++) {

      if (sb.length() > 0) {
        sb.append(",");
      }
      sb.append(topicsArray.get(i));
    }
    return sb.toString();
  }
544186
public List<String> split(String s) {

        List<String> result = new ArrayList<String>();

        if (s == null) {
            return result;
        }

        boolean seenEscape = false;

        // Used to detect if the last char was a separator,
        // in which case we append an empty string
        boolean seenSeparator = false;

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            seenSeparator = false;
            char c = s.charAt(i);
            if (seenEscape) {
                if (c == escapeChar || c == separator) {
                    sb.append(c);
                } else {
                    sb.append(escapeChar).append(c);
                }
                seenEscape = false;
            } else {
                if (c == escapeChar) {
                    seenEscape = true;
                } else if (c == separator) {
                    if (sb.length() == 0 && convertEmptyToNull) {
                        result.add(null);
                    } else {
                        result.add(sb.toString());
                    }
                    sb.setLength(0);
                    seenSeparator = true;
                } else {
                    sb.append(c);
                }
            }
        }

        // Clean up
        if (seenEscape) {
            sb.append(escapeChar);
        }

        if (sb.length() > 0 || seenSeparator) {

            if (sb.length() == 0 && convertEmptyToNull) {
                result.add(null);
            } else {
                result.add(sb.toString());
            }

        }

        return result;
    }
950285
public static List<String> split(
                    final String str
                    )
    {
        String  s = str;
        if (s != null) {
            s = s.trim();
        }

        List<String>  list = new ArrayList<String>();
        if (s == null || s.length() == 0) {
            return list;
        }

        String[]  tokens = s.split( "[ \t\n\r\f]" );
        // NOTE: tokens[i] may be an empty string "".

        // excludes empty strings.
        for (String  t : tokens) {
            if (t.length() > 0) {
                list.add( t );
            }
        }

        return list;
    }
755104
public static String mkString(@javax.annotation.Nonnull final String separator, final String... strs) {
    return Arrays.asList(strs).stream().collect(Collectors.joining(separator));
  }
637726
@SneakyThrows
   public static List<String> split(CharSequence input, char separator) {
      if (input == null) {
         return new ArrayList<>();
      }
      Preconditions.checkArgument(separator != '"', "Separator cannot be a quote");
      try (CSVReader reader = CSV.builder().delimiter(separator).reader(new StringReader(input.toString()))) {
         List<String> all = new ArrayList<>();
         List<String> row;
         while ((row = reader.nextRow()) != null) {
            all.addAll(row);
         }
         return all;
      }
   }
733999
def split(self, sep=TOKENS):
        
        if sep != TOKENS:
            return unicode.split(self, sep)
        if len(self) == 0:
            return []
        return [[[x.replace("&slash;", "/") for x in token.split("/")]
            for token in sentence.split(" ")]
                for sentence in unicode.split(self, "\n")]
395265
public Map<String,String> parse(final String str, char separator) {
		if (str == null) {
			return new HashMap<String,String>();
		}
		return parse(str.toCharArray(), separator);
	}
1175579
public static String join(String[] strings, String separator) {
      StringBuilder sb = new StringBuilder();
      boolean first = true;
      for (String s : strings) {
         if (first) {
            first = false;
         } else {
            sb.append(separator);
         }
         sb.append(s);
      }
      return sb.toString();
   }
64120
public static List<String> splitSentence2(String text, SentenceDetector sd) {
        List<String> sentences = new ArrayList<String>();
        try {
            int sentenceOffsets[] = sd.sentPosDetect(text);

            int begin = 0;
            int end = 0;
            for (int i = 0; i < sentenceOffsets.length; i++) {
                end = begin
                        + (text.substring(begin, sentenceOffsets[i]).trim())
                                .length();
                sentences.add(text.substring(begin, end));
                begin = sentenceOffsets[i];
            }
        } catch (Exception e) {
            LOG.warn("failed to extract sentences from text '" + text + "'", e);
        }
        return sentences;
    }
1079716
public static double[] stringToDoubleArray( String string, String separator ) {
        if (separator == null) {
            separator = ",";
        }
        String[] stringSplit = string.trim().split(separator);
        double[] array = new double[stringSplit.length];
        for( int i = 0; i < array.length; i++ ) {
            array[i] = Double.parseDouble(stringSplit[i].trim());
        }
        return array;
    }
448196
public String join(String separator, final String keyValueSeparator) {
		return MapUtil.join(this.map, separator, keyValueSeparator);
	}
77786
public static List<String> splitNicely( String toSplit, String separator ) {

		if( separator == null || separator.isEmpty())
			throw new IllegalArgumentException( "The separator cannot be null or the empty string." );

		return splitNicelyWithPattern( toSplit, Pattern.quote( separator ));
	}