001 package org.codehaus.groovy.tools; 002 003 /** 004 * Various utility functions for use in the compiler. 005 */ 006 007 public abstract class Utilities 008 { 009 /** 010 * Returns a string made up of repetitions of the specified string. 011 */ 012 013 public static String repeatString( String pattern, int repeats ) 014 { 015 StringBuffer buffer = new StringBuffer( pattern.length() * repeats ); 016 for( int i = 0; i < repeats; i++ ) 017 { 018 buffer.append( pattern ); 019 } 020 021 return new String( buffer ); 022 } 023 024 025 /** 026 * Returns the end-of-line marker. 027 */ 028 029 public static String eol() 030 { 031 return eol; 032 } 033 034 private static String eol = System.getProperty( "line.separator", "\n" ); 035 036 }