Java String Indent Format indent(final StringBuilder sb, final int indent)

Here you can find the source of indent(final StringBuilder sb, final int indent)

Description

Appends to a given StringBuilder the given indents depending on the indent level.

License

Open Source License

Parameter

Parameter Description
sb StringBuilder to write in.
indent The number (level) of indents.

Declaration

private static final void indent(final StringBuilder sb, final int indent) 

Method Source Code

//package com.java2s;

public class Main {
    /** Indent for each line (dependent of the level of indent). */
    public static final String LOG_OUT_INDENT = "  ";

    /**/*from w  w  w . j  a  va  2  s  . co  m*/
     * Appends to a given StringBuilder the given indents depending on the indent level.
     * 
     * @param sb StringBuilder to write in.
     * @param indent The number (level) of indents.
     */
    private static final void indent(final StringBuilder sb, final int indent) {

        for (int i = 0; i < indent; i++) {
            sb.append(LOG_OUT_INDENT);
        }
    }
}

Related

  1. indent(final String string, final String separator)
  2. indent(final StringBuffer buffer, final String text, final int indent)
  3. indent(final StringBuilder aSb, final String aIndentString)
  4. indent(final StringBuilder buf, int level)
  5. indent(final StringBuilder s, final int depth)
  6. indent(int count)
  7. indent(int i, String s)
  8. indent(int indent)
  9. indent(int indent)