Splits a string into tokens at the specified delimiter.

@param str The string to split. Must not be null.
@param delim The delimiter character.
@return A list of tokens. Will not return null.
559570
private static List<String> split(String str, char delim) {

    List<String> result = Lists.newArrayList();

    int currPartStart = 0;
    while (true) {
      int currPartEnd = str.indexOf(delim, currPartStart);
      if (currPartEnd == -1) {
        result.add(str.substring(currPartStart));
        break;
      } else {
        result.add(str.substring(currPartStart, currPartEnd));
        currPartStart = currPartEnd + 1;
      }
    }

    return result;
  }
1080193
private static List<String> split(String str) {
        List<String> result = new ArrayList<String>();
        int genericCount = 0;
        int startPos = 0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == ',' && genericCount == 0) {
                result.add(str.substring(startPos, i).trim());
                startPos = i + 1;
            } else if (str.charAt(i) == '<') {
                genericCount++;
            } else if (str.charAt(i) == '>') {
                genericCount--;
            }
        }
        result.add(str.substring(startPos).trim());
        return result;
    }
376258
public static Iterable<String> split(String separator, String stringToSplit) {

    String[] StringArray = stringToSplit.split(separator);

    Iterable<String> iterable = Arrays.asList(StringArray);

    return iterable;
  }
665534
public static String[] split(String strings, String separator) {
		return split(strings, separator, DEFAULT_TRIM);
	}
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;
    }
949443
def split(self, delimiter=None):
        
        result = []
        strings = self.strings[:]
        current = None

        while strings:
            is_literal, value = strings[0]
            parts = value.split(delimiter, 1)
            if len(parts) > 1:
                value1, value2 = parts
                strings[0] = (is_literal, value2)
                out = EscapedString(value1, is_literal)
                push = True
            else:
                strings = strings[1:]
                out = EscapedString(value, is_literal)
                push = False

            if current is None:
                current = out
            else:
                current = current + out
            if push:
                result.append(current)
                current = None

        if current:
            result.append(current)
        return result
955236
public static List<String> splitAsList(String text, String delimiter) {
        List<String> answer = new ArrayList<String>();
        if (text != null && text.length() > 0) {
            answer.addAll(Arrays.asList(text.split(delimiter)));
        }
        return answer;
    }
1306185
public static String arrayToDelimitedString(Object[] arr, String delim) {
        if (Objects.isEmpty(arr)) {
            return "";
        }
        if (arr.length == 1) {
            return Objects.nullSafeToString(arr[0]);
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.length; i++) {
            if (i > 0) {
                sb.append(delim);
            }
            sb.append(arr[i]);
        }
        return sb.toString();
    }
856437
protected List<String> split(final String string){
        if (null!=prefix){
            //remove prefix before split
            return Arrays.asList(string.substring(prefix.length()).split(delimiter));
        }else{
            return Arrays.asList(string.split(delimiter));
        }

    }
693919
public static String[] stringToStringArray(final String instr, final String delim) throws NoSuchElementException, NumberFormatException {
        final StringTokenizer toker = new StringTokenizer(instr, delim);
        final String stringArray[] = new String[toker.countTokens()];
        int i = 0;
        while (toker.hasMoreTokens()) {
            stringArray[i++] = toker.nextToken();
        }
        return stringArray;
    }
1135208
static String[] tokenize(String str) {
        char sep = '.';
        int start = 0;
        int len = str.length();
        int count = 0;
        for (int pos = 0; pos < len; pos++) {
            if (str.charAt(pos) == sep) {
                if (pos != start) {
                    count++;
                }
                start = pos + 1;
            }
        }
        if (len != start) {
            count++;
        }
        String[] l = new String[count];

        count = 0;
        start = 0;
        for (int pos = 0; pos < len; pos++) {
            if (str.charAt(pos) == sep) {
                if (pos != start) {
                    String tok = str.substring(start, pos);
                    l[count++] = tok;
                }
                start = pos + 1;
            }
        }
        if (len != start) {
            String tok = str.substring(start);
            l[count/* ++ */] = tok;
        }
        return l;
    }
389021
public static String[] tokenize(String str, String delimiters) {
        return tokenize(str, delimiters, false);
    }
1307659
public Collection<Text> split(char separator) {
        int pointer = pos;
        int limit = pos + len;
        int mark = pointer;

        ArrayList<Text> tokens = new ArrayList<Text>();
        while (pointer < limit) {
            if (chars[pointer] == separator) {
                tokens.add(new Text(chars, mark, pointer - mark));
                mark = pointer + 1;
            }
            pointer++;
        }
        
        tokens.add(new Text(chars, mark, limit - mark));        
        return tokens;
    }
452050
def split(string, separator_regexp=None, maxsplit=0):
    
    if not string:
        return []
    if separator_regexp is None:
        separator_regexp = _default_separator()
    if not separator_regexp:
        return string.split()
    return re.split(separator_regexp, string, maxsplit)
615715
function (delimiter, string, limit) {

            if (arguments.length < 2 ||
                typeof delimiter === "undefined" ||
                typeof string === "undefined"
            ) {
                return null;
            }

            if (delimiter === "" ||
                delimiter === false ||
                delimiter === null
            ) {
                return false;
            }

            if (delimiter === true) {
                delimiter = "1";
            }

            // Here we go...
            delimiter += "";
            string += "";

            var splited = string.split(delimiter);

            if (typeof limit === "undefined") {
                return splited;
            }

            // Support for limit
            if (limit === 0) {
                limit = 1;
            }

            // Positive limit
            if (limit > 0) {
                if (limit >= splited.length) {
                    return splited;
                }

                return splited.slice(0, limit - 1)
                    .concat([splited.slice(limit - 1)
                        .join(delimiter)
                    ]);
            }

            // Negative limit
            if (-limit >= splited.length) {
                return [];
            }

            splited.splice(splited.length + limit);

            return splited;
        }
50893
public static List<String> split(String str, String separatorChars)
  {
    final String[] array = StringUtils.split(str, separatorChars);

    return Arrays.asList(array);
  }
554271
public AsciiString[] split(char delim) {
        final List<AsciiString> res = InternalThreadLocalMap.get().arrayList();

        int start = 0;
        final int length = length();
        for (int i = start; i < length; i++) {
            if (charAt(i) == delim) {
                if (start == i) {
                    res.add(EMPTY_STRING);
                } else {
                    res.add(new AsciiString(value, start + arrayOffset(), i - start, false));
                }
                start = i + 1;
            }
        }

        if (start == 0) { // If no delimiter was found in the value
            res.add(this);
        } else {
            if (start != length) {
                // Add the last element if it's not empty.
                res.add(new AsciiString(value, start + arrayOffset(), length - start, false));
            } else {
                // Truncate trailing empty elements.
                for (int i = res.size() - 1; i >= 0; i--) {
                    if (res.get(i).isEmpty()) {
                        res.remove(i);
                    } else {
                        break;
                    }
                }
            }
        }

        return res.toArray(new AsciiString[0]);
    }