Monday, 25 April 2016
Splitting a java String by the pipe symbol using String.split()
Just using pipe "|" inside split function will not work :
String test = "A|B|C||D";
String[] result = test.split("
|
");
You need to escape that special character using \\
String[] result = test.split("
\\|
");
No comments:
Post a Comment
Note: only a member of this blog may post a comment.
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.