Created
March 17, 2010 08:57
-
-
Save yuroyoro/335044 to your computer and use it in GitHub Desktop.
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 PrintWithLineNumber{ | |
import scala.io.Source | |
def printWithLineNumber( fileName:String ) = | |
Source.fromFile( fileName ). | |
getLines. | |
zipWithIndex. | |
map{ case ( s, n ) => "%s:%s" format( n, s ) }. | |
foreach{ print } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment