Skip to content

Instantly share code, notes, and snippets.

@aruld
Created October 7, 2012 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aruld/3847331 to your computer and use it in GitHub Desktop.
Save aruld/3847331 to your computer and use it in GitHub Desktop.
exists in scala
object TweetUtil {
def main(args: Array[String]) {
val keywords = List("brown", "fox", "dog", "pangram")
val tweet = "The quick brown fox jumps over a lazy dog. #pangram http://www.rinkworks.com/words/pangrams.shtml"
keywords.exists(tweet.contains)
(keywords.foldLeft(false)( _ || tweet.contains(_) ))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment