Rosetta Code/Count examples: Difference between revisions

Add ==
(Added Scala example)
(Add ==)
Line 430:
val allTasks = xml.parsing.XhtmlParser(fromURL(new URL(allTasksURL)))
 
val regexExpr = "(?i)==\\{\\{header\\|".r
def oneTaskURL(title: String) = "http://www.rosettacode.org/w/index.php?title=%s&action=raw" format URLEncoder.encode(title.replace(' ', '_'), "UTF-8")
def count(title: String) = regexExpr findAllIn fromURL(new URL(oneTaskURL(title)))(io.Codec.UTF8).mkString length
Anonymous user