Questions tagged [split]

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

It is most often applied when splitting a string by a delimiter, such as when parsing a comma separated value file. Some languages such as Ruby and Java support splitting a string according to regular expression as well.

A split string produces an array of strings.

split can also refer to

  1. the split function
  2. the String#split method
  3. the str.split method
  4. the explode function.
  5. the split method
  6. the split method
  7. the // String.Split method
  8. the / split command line utility
  9. the STRING_SPLIT function

All these functions/methods split strings on a delimiter.

The split function in divides data into groups by a specified factor.

24261 questions
5
votes
2 answers

Coverting webm to wav with ffmpeg

I've succesfully used ffmpeg in Python to convert mp3-files into wav so I can post them to Google Speech-To-Text. Now I have same situation with webm files and the old function I have doesn't work. It should convert the file into wav and split it…
lr_optim
  • 299
  • 1
  • 10
  • 30
5
votes
1 answer

AttributeError: 'DatasetAutoFolds' object has no attribute 'split'

the code s from a recommendation engine using surprise module, i can't find the answer anywhere.
Raj Singh
  • 408
  • 1
  • 7
  • 17
5
votes
3 answers

Splitting A File On Delimiter

I have a file on a Linux system that is roughly 10GB. It contains 20,000,000 binary records, but each record is separated by an ASCII delimiter "$". I would like to use the split command or some combination thereof to chunk the file into smaller…
Jeffrey Kevin Pry
  • 3,266
  • 3
  • 35
  • 67
5
votes
3 answers

Splitting string to individual characters using slicing

I'm confused how the following python code works to split a string to individual characters using b[:0] = a. Shouldn't it be just b = ['abc']? a='abc' b=[] b[:0]=a print(b) output: b=[a,b,c]
5
votes
2 answers

perl - split string into 2-character groups

Possible Duplicate: How can I split a string into chunks of two characters each in Perl? I wanted to split a string into an array grouping it by 2-character pieces: $input = "DEADBEEF"; @output = split(/(..)/,$input); This approach produces…
SF.
  • 13,549
  • 14
  • 71
  • 107
5
votes
1 answer

Accessing the body of a split entrySet in Apache Camel

The body of my message contains a HashMap. I split this message by its entrySet: .from(FROM) .aggregate(...) // create an iterable .transform(simple("${in.body.entrySet()}")) // split over the Iterable .split(body()) …
JMoore
  • 95
  • 2
  • 8
5
votes
7 answers

Split a string by word using one of any or all delimiters?

I may have just hit the point where i;m overthinking it, but I'm wondering: is there a way to designate a list of special characters that should all be considered delimiters, then splitting a string using that list?…
Sinaesthetic
  • 11,426
  • 28
  • 107
  • 176
5
votes
4 answers

Split String by Delimiter and Include Delimiter - Common Lisp

How can I split a string by a delimiter in Common Lisp, like is done in SPLIT-SEQUENCE, but also add the delimiter in the list of strings? For example, I could write: (split-string-with-delimiter #\. "a.bc.def.com") and the result would be ("a" "."…
Nicholas
  • 570
  • 1
  • 5
  • 15
5
votes
4 answers

How to split a string of only ten characters e.g."12345*45688" into an array

I'm making a simple calculator where you type values into an edit box. I need to split the string into a number of arrays depending on how many *+-/ there are in the sum for instance I have 22+22*22-22/22 I want to break that into five different…
user744061
  • 51
  • 2
5
votes
1 answer

What is the equivalent of PHP's list() function in Java?

What is the equivalent of PHP's list() function in Java? For example $matches = array('12', 'watt'); list($value, $unit) = $matches;
M4rk
  • 2,172
  • 5
  • 36
  • 70
5
votes
6 answers

Walk through a list split function in Haskell

This is a follow up to my previous question. I am trying to understand the list splitting example in Haskell from here: foldr (\a ~(x,y) -> (a:y,x)) ([],[]) I can read Haskell and know what foldr is but don't understand this code. Could you walk me…
Michael
  • 41,026
  • 70
  • 193
  • 341
5
votes
7 answers

JS split string and return index of each split

I want to split text on a certain regex and also to have an index of where that split starts in the original string. On a simple example: "bla blabla haha".splitOnRegexWithIndex(whitespaceRegex) Needed output is [["bla", 0], ["blabla", 4],…
Nikola Dim
  • 736
  • 7
  • 21
5
votes
2 answers

Split dataset per rows into smaller files in R

I am analyzing a dataset, with 1.14 GB (1,232,705,653 bytes). When reading the data in R: trade = read.csv("commodity_trade_statistics_data.csv") One can see that it has 8225871 instances and 10 attributes. As I intend to analyze the dataset…
Gonçalo Peres
  • 11,752
  • 3
  • 54
  • 83
5
votes
3 answers

split xml value with xpath and check string position

I have the following xml file: Course 1 00162 2,2,1,1,2,1,1,1 I need to query the file (I'm using xpath) to split the 'questions'…
netNewbi3
  • 279
  • 6
  • 20
5
votes
3 answers

split and replace unicode words in javascript with regex

Need to put list of unicode words in unicode string in {}. There is my code: var txt = "¿One;one oneé two two two two two twö twöu three;;twä;föur?"; var re = new RegExp("(^|\\W)(one|tw|two two|two|twöu|three|föur)(?=\\W|$)",…
John
  • 51
  • 1
  • 2