Java String Indent Format indent(String in)

Here you can find the source of indent(String in)

Description

indent

License

Open Source License

Declaration

public static String indent(String in) 

Method Source Code

//package com.java2s;

public class Main {
    public static String indent(String in) {
        StringBuilder sb = new StringBuilder(in);
        sb.insert(0, "  ");
        for (int i = 0; i < sb.length(); i++) {
            char c = sb.charAt(i);
            if (c == '\n') {
                sb.insert(i + 1, "  ");
            }/*from w w  w.  j  a  v  a2 s  . c  o m*/
        }
        return sb.toString();
    }
}

Related

  1. indent(int nSpaces)
  2. indent(int number)
  3. indent(int numSpaces)
  4. indent(int numSpaces)
  5. indent(int tabCount)
  6. indent(String in)
  7. indent(String input, int depth, int start)
  8. indent(String lines, String indentation)
  9. indent(String message, int indent)