28.08.2016 Views

scala_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Scala<br />

val pattern = new Regex("abl[ae]\\d+")<br />

val str = "ablaw is able1 and cool"<br />

println((pattern findAllIn str).mkString(","))<br />

}<br />

}<br />

Save the above program in Demo.<strong>scala</strong>. The following commands are used to compile and<br />

execute this program.<br />

\><strong>scala</strong>c Demo.<strong>scala</strong><br />

\><strong>scala</strong> Demo<br />

Output:<br />

able1<br />

160

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!