org.spockframework.util
Class TextUtil

java.lang.Object
  extended by org.spockframework.util.TextUtil

public abstract class TextUtil
extends Object

Utility methods for text processing.

Author:
Peter Niederwieser

Constructor Summary
TextUtil()
           
 
Method Summary
static void changeIndent(List<String> lines, int delta)
           
static String changeIndent(String line, int delta)
           
static int countOccurrences(String text, char symbol)
           
static String erase(String line, int from)
           
static String erase(String line, int from, int to)
           
static int getIndent(List<String> lines)
           
static int getIndent(String line)
           
static int getTrailingWhitespace(String line)
          Returns the number of whitespace characters at the end of the given line.
static String join(List<?> objects, String separator)
           
static String repeatChar(char ch, int times)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextUtil

public TextUtil()
Method Detail

repeatChar

public static String repeatChar(char ch,
                                int times)

getIndent

public static int getIndent(String line)

getIndent

public static int getIndent(List<String> lines)

changeIndent

public static String changeIndent(String line,
                                  int delta)

changeIndent

public static void changeIndent(List<String> lines,
                                int delta)

erase

public static String erase(String line,
                           int from,
                           int to)

erase

public static String erase(String line,
                           int from)

getTrailingWhitespace

public static int getTrailingWhitespace(String line)
Returns the number of whitespace characters at the end of the given line.

Parameters:
line -
Returns:

join

public static String join(List<?> objects,
                          String separator)

countOccurrences

public static int countOccurrences(String text,
                                   char symbol)


Copyright © 2010. All Rights Reserved.