01: package org.codehaus.groovy.tools;
02:
03: /**
04: * Various utility functions for use in the compiler.
05: */
06:
07: public abstract class Utilities {
08: /**
09: * Returns a string made up of repetitions of the specified string.
10: */
11:
12: public static String repeatString(String pattern, int repeats) {
13: StringBuffer buffer = new StringBuffer(pattern.length()
14: * repeats);
15: for (int i = 0; i < repeats; i++) {
16: buffer.append(pattern);
17: }
18:
19: return new String(buffer);
20: }
21:
22: /**
23: * Returns the end-of-line marker.
24: */
25:
26: public static String eol() {
27: return eol;
28: }
29:
30: private static String eol = System.getProperty("line.separator",
31: "\n");
32:
33: }
|