|
is treated as an OR
in RegEx. So you need to escape it:
String[] separated = line.split("\\|");
More Related Contents:
- How to split to string Java
- Need some advice on split() method in Java [closed]
- Java String split removed empty values
- How to split a string with any whitespace chars as delimiters
- How to split a String by space
- Splitting on comma outside quotes
- Java string split with “.” (dot) [duplicate]
- Splitting a string at every n-th character
- Why is StringTokenizer deprecated?
- How to split a string in Java
- string to string array conversion in java
- How can I use “.” as the delimiter with String.split() in java [duplicate]
- How to split String with some separator but without removing that separator in Java? [duplicate]
- How do I split a string in Java?
- Extracting pairs of words using String.split()
- Java String.split() Regex
- Split a string, at every nth position
- Java String.split() sometimes giving blank strings
- Java split string to array [duplicate]
- Java: String split(): I want it to include the empty strings at the end [duplicate]
- How to Split a mathematical expression on operators as delimiters, while keeping them in the result?
- Split the string on forward slash
- The split() method in Java does not work on a dot (.) [duplicate]
- A method to reverse effect of java String.split()? [duplicate]
- Java split String performances
- split string only on first instance – java
- Java: Get last element after split
- Java equivalent to Explode and Implode(PHP) [closed]
- Split string into repeated characters
- Java replace all square brackets in a string