View Javadoc

    1   package org.codehaus.groovy.tools;
    2
    3   /***
    4    *  Various utility functions for use in the compiler.
    5    */
    6
    7   public abstract class Utilities
    8   {
    9      /***
    10      *  Returns a string made up of repetitions of the specified string.
    11      */
    12
    13      public static String repeatString( String pattern, int repeats )
    14      {
    15          StringBuffer buffer = new StringBuffer( pattern.length() * repeats );
    16          for( int i = 0; i < repeats; i++ )
    17          {
    18              buffer.append( pattern );
    19          }
    20
    21          return new String( buffer );
    22      }
    23
    24
    25     /***
    26      *  Returns the end-of-line marker.
    27      */
    28
    29      public static String eol()
    30      {
    31          return eol;
    32      }
    33
    34      private static String eol = System.getProperty( "line.separator", "\n" );
    35
    36  }