Skip to content

Instantly share code, notes, and snippets.

@raj638111
Last active April 28, 2016 17:49
Show Gist options
  • Save raj638111/98ba74c89ec8e2482ff06e0c0d5fb434 to your computer and use it in GitHub Desktop.
Save raj638111/98ba74c89ec8e2482ff06e0c0d5fb434 to your computer and use it in GitHub Desktop.
A Gist about split() method
/************************************************************
Split a string with a delimiter of ||
************************************************************/
scala> val line = "This is a line || line"
line: String = This is a line || line
// http://stackoverflow.com/questions/9808689/why-does-string-split-need-pipe-delimiter-to-be-escaped
scala> line.split("\\|\\|")
res6: Array[String] = Array("This is a line ", " line")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment