Top "Split" questions

Use this tag for questions about separating an item (e.g. a string) into parts, often by a delimiter or regular expression.

Why are empty strings returned in split() results?

What is the point of '/segment/segment/'.split('/') returning ['', 'segment', 'segment', '']? Notice the empty …

python string split
Remove characters before and including _ in python 2.7

The following code returns into a nice readable output. def add_line_remove_special(ta_from,endstatus,*args,**kwargs): try: …

python string python-2.7 split word-wrap
When splitting an empty string in Python, why does split() return an empty list while split('\n') returns ['']?

I am using split('\n') to get lines in one string, and found that ''.split() returns an empty …

python string algorithm parsing split
Python partition and split

I want to split a string with two words like "word1 word2" using split and partition and print (using a …

python string python-2.7 split partition
How to extract the first and final words from a string?

I have a small problem with something I need to do in school... My task is the get a raw …

python string split extract
Split list into multiple lists with fixed number of elements

How to split a List of elements into lists with at most N items? ex: Given a list with 7 elements, …

list scala split
Java split() method strips empty strings at the end?

Check out the below program. try { for (String data : Files.readAllLines(Paths.get("D:/sample.txt"))){ String[] de = data.split(";"); …

java split
How to split text without spaces into list of words?

Input: "tableapplechairtablecupboard..." many words What would be an efficient algorithm to split such text to the list of words and …

python algorithm text split
Split JavaScript array in chunks using Lodash

I need to split a JavaScript array into n sized chunks. E.g.: Given this array ["a1", "a2", "a3", "a4", "…

javascript split functional-programming underscore.js lodash
Objective-C Split()?

Is there any way to split strings in objective c into arrays? I mean like this - input string Yes:0:42:…

iphone objective-c function split