====== Groovy String Format ====== ===== sprintf ===== * Groovy Object에 기본적으로 ''sprintf'' 메소드가 내장됨. [[https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#format(java.lang.String,%20java.lang.Object...)|Java의 String.format]] 메소드와 같은 역할. * [[http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html|java.util.Formatter]]에서 포맷 참조. * [[http://mrhaki.blogspot.kr/2009/12/groovy-goodness-formatted-strings-with.html|Groovy Goodness: Formatted Strings with sprintf - Messages from mrhaki]] assert 'Groovy is cool!' == sprintf( '%2$s %3$s %1$s', ['cool!', 'Groovy', 'is']) assert '00042' == sprintf('%05d', 42)