Java

Split String using | (pipe) symbol method

Split string using |

If you try to split string using |(pipe) symbol as below

myString.split("|");

it doesn’t work as expected. As it means “split on every character.”

So you should try with double backward slash and Pipe symbol as below

myString.split("\\|");

Hope it helps somebody…

🙂

ref link & credits: http://hoskinator.blogspot.in/2006/11/trouble-using-pipe-with-stringsplit.html

You may also interested in following

Leave a Reply

Your email address will not be published. Required fields are marked *