Created
October 7, 2012 06:34
-
-
Save aruld/3847331 to your computer and use it in GitHub Desktop.
exists in scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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