There is a package for this called split.
cabal install split
Use it like this:
ghci> import Data.List.Split ghci> splitOn "," "my,comma,separated,list" ["my","comma","separated","list"]
It comes with a lot of other functions for splitting on matching delimiters or having several delimiters.
Related Posts:
- Understanding the functions elem and isInfixOf
- Haskell – parse error on input `|’
- absolute values in Haskell
- Haskell: Converting Int to String
- Reverse a list in haskell
- Haskell Merge Sort
- Difference between `mod` and `rem` in Haskell
- How to fix “variable not in scope” error in GHCI?
- Division in Haskell
- What does the “Just” syntax mean in Haskell?
- How do I lowercase a string in Python?
- How do I convert a String to an int in Java?
- How to format strings in Java
- How do I get a substring of a string in Python?
- Substring in excel
- Does Python have a string ‘contains’ substring method?
- Why the switch statement cannot be applied on strings?
- How does strtok() split the string into tokens in C?
- Convert bytes to a string
- Java – Convert integer to string [duplicate]
- Replacing instances of a character in a string
- Changing one character in a string
- How to read a file line-by-line into a list?
- What is lexicographical order?
- strip(char) on a string
- How to convert string to char array in C++?
- How can I convert a std::string to int?
- How to convert list to string [duplicate]
- Easiest way to convert int to string in C++
- TypeError: a bytes-like object is required, not ‘str’ when writing to a file in Python3
- How to check whether a string contains a substring in JavaScript?
- Check if a string has a certain piece of text [duplicate]
- Converting integer to string in Python
- Reverse a string in Python
- How to split a string in Java
- How do I compare strings in Java?
- How to replace all occurrences of a string in JavaScript
- How do I compare two strings in python?
- std::string to char*
- How can I convert String to Int?
- How to convert a string to an integer in JavaScript?
- How to convert string to char array in C++?
- How to convert an int to string in C?
- C++ — expected primary-expression before ‘ ‘
- How can I do string interpolation in JavaScript?
- How to convert a char to a String?
- Regex not operator
- How to convert/parse from String to char in java?
- C++ string to double conversion
- How do I make the first letter of a string uppercase in JavaScript?
- Reverse a string in Java
- working of \n in python [duplicate]
- ValueError: could not convert string to float: id
- How do I make the first letter of a string uppercase in JavaScript?
- Regex not operator
- Print string to text file
- Reverse a string in Java
- What is a string of hexadecimal digits?
- Best way to convert string to bytes in Python 3?
- Pythonic way to create a long multi-line string
- Best way to convert string to bytes in Python 3?
- Does Python have a string ‘contains’ substring method?
- Extract a substring using PowerShell
- Java String Split by “|”
- Convert String to double in Java
- TypeError: not all arguments converted during string formatting python
- Conversion from string to char – c++
- How to convert an int to string in C?
- Array to String PHP?
- How can I exclude one word with grep?
- What is `CString`?
- Java String new line
- Creating multiline strings in JavaScript
- Extract substring in Bash
- Regex not operator
- ‘str’ object does not support item assignment
- How to check if a String contains another String in a case insensitive manner in Java?
- How do I append one string to another in Python?
- Java split string to array [duplicate]
- How to convert a string to integer in C?
- String concatenation: concat() vs “+” operator
- How to compare strings in Bash
- How do I append one string to another in Python?
- How do I check if a string contains a specific word?
- How to remove the last character from a string?
- Random string generation with upper case letters and digits
- How do I include the string header?
- How do I create an array of strings in C?
- How can I split and parse a string in Python?
- Creating multiline strings in JavaScript
- Split string into array
- How do I break a string in YAML over multiple lines?
- Java string to date conversion
- Differences between C++ string == and compare()?
- How to replace � in a string
- Change date format in a Java string
- How to convert a char array to a string?
- What are all the escape characters?
- node.js string.replace doesn’t work?
- Converting String to “Character” array in Java