Skip to content

Instantly share code, notes, and snippets.

@fbettag
Created August 17, 2012 00:48
Show Gist options
  • Select an option

  • Save fbettag/3374892 to your computer and use it in GitHub Desktop.

Select an option

Save fbettag/3374892 to your computer and use it in GitHub Desktop.
Not working regexp splits scala :/
scala> "ffff".split("..")
res0: Array[java.lang.String] = Array()
scala> "ffff".split("..".r)
<console>:8: error: type mismatch;
found : scala.util.matching.Regex
required: java.lang.String
"ffff".split("..".r)
^
scala> "..".r.split("ffff")
res2: Array[String] = Array()
scala>
@dcbriccetti
Copy link
Copy Markdown

You want to split by what two characters?

scala> "a b c d".split(" ")
res4: Array[java.lang.String] = Array(a b, c d)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment