Printf in groovy

This shows you how to use the printf function in groovy to print a tic tac toe field like this:

   | x | o
---+---+---
   | x |
---+---+---
 o |   |

in stdout


def field = [["","x","o"],["","x",""],["o","",""]]
field.eachWithIndex { line,index ->
	if(index > 0) {
		println "---+" * 2 + "---"
	}
	printf(" %-2s| %-2s| %-2s\n", line)
}