Java String Indent Format indent(StringBuilder builder, int indent)

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

Description

Adds indent to builder.

License

Open Source License

Parameter

Parameter Description
builder builder to indent
indent amount of indent

Return

builder

Declaration

public static StringBuilder indent(StringBuilder builder, int indent) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from w  ww  . ja  v a 2  s  .  c o m
     * Indent string.
     */
    public static final String INDENT = "    ";

    /**
     * Adds indent to builder.
     *
     * @param builder builder to indent
     * @param indent amount of indent
     * @return builder
     */
    public static StringBuilder indent(StringBuilder builder, int indent) {
        while (0 < indent) {
            builder.append(INDENT);
            indent--;
        }
        return builder;
    }
}

Related

  1. indent(String value, int spaces)
  2. indent(StringBuffer buffer, int depth)
  3. indent(StringBuffer sb, int indentLevel)
  4. indent(StringBuilder b, int i)
  5. indent(StringBuilder buffer, int d)
  6. indent(StringBuilder builder, int indent)
  7. indent(StringBuilder builder, int times)
  8. indent(StringBuilder sb, int indent)
  9. indent(StringBuilder sb, int indent)