Advertisement
Guest User

Untitled

a guest
May 6th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.47 KB | None | 0 0
  1. import java.io.PrintWriter
  2. import scala.io.Source
  3.  
  4. //**Lab 9 CSC 110 Prof. Duncan
  5. //**Andy Mechalakos
  6. val term = args(0)
  7. val sampleInput = args(1)
  8. val sampleOutput = args(2)
  9. val out = new PrintWriter(sampleOutput)
  10.  
  11. println("I am searching for "+ term)
  12.  
  13. val inputStream = Source.fromFile(sampleInput)
  14. val lines = inputStream.getLines
  15. // println(lines.mkString("\n"))
  16. for (line <- lines if line.toLowerCase.contains(term))
  17. {
  18. out.println(line)
  19. println(line)  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement