Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Steven Devijver

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Format code with line numbers in Markdown notation

   1  
   2  C:\>type Format.groovy | groovy Format
   3       1: def counter = 1
   4       2:
   5       3: System.in.eachLine {
   6       4:         line ->
   7       5:
   8       6:         def result = "    "
   9       7:         (2 - ("" + counter).length()).times { result += " " }
  10       8:         result += "${counter}: ${line}"
  11       9:         println result
  12      10:         counter++
  13      11: }
  14  
  15  C:\>


   1  
   2  def counter = 1
   3  
   4  System.in.eachLine {
   5  	line ->
   6  	
   7  	def result = "    "
   8  	(2 - ("" + counter).length()).times { result += " " }
   9  	result += "${counter}: ${line}"
  10  	println result
  11  	counter++
  12  }
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS