edu.mit.ai.psg.strings
Class Indent

java.lang.Object
  |
  +--edu.mit.ai.psg.strings.Indent

public final class Indent
extends Object


Method Summary
static String leadingWhitespace(String string)
           
static String makeSpaces(int length)
          make a short string length spaces long.
static String string(int spaces, String stringToIndent)
          adds spaces after every non-final newline (not at beginning)
static String string(String indent, String stringToIndent)
          adds indent after every non-final newline (not at beginning)
static String string(String indent, String stringToIndent, boolean addToStart)
          adds indent after every non-final newline; if addToStart is true, adds indent at beginning as well.
static String trimNewlines(String untrimmedString)
          like String.trim(), but preserves indentation
static String unindent(int spaces, String stringToUnindent)
          delete spaces where they appears in string at beginning and after newlines
static String unindent(String indent, String stringToUnindent)
          delete indent where it appears in string at beginning and after newlines
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

string

public static String string(int spaces,
                            String stringToIndent)
adds spaces after every non-final newline (not at beginning)

string

public static String string(String indent,
                            String stringToIndent)
adds indent after every non-final newline (not at beginning)

string

public static String string(String indent,
                            String stringToIndent,
                            boolean addToStart)
adds indent after every non-final newline; if addToStart is true, adds indent at beginning as well.

makeSpaces

public static String makeSpaces(int length)
make a short string length spaces long.

trimNewlines

public static String trimNewlines(String untrimmedString)
like String.trim(), but preserves indentation

unindent

public static final String unindent(int spaces,
                                    String stringToUnindent)
delete spaces where they appears in string at beginning and after newlines

unindent

public static final String unindent(String indent,
                                    String stringToUnindent)
delete indent where it appears in string at beginning and after newlines

leadingWhitespace

public static final String leadingWhitespace(String string)

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-bugs@ai.mit.edu