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;
//License from project: Open Source License 

public class Main {
    public static String indent(String in) {
        return indent(in, "\t");
    }//w ww . j  av a 2 s  . c  o  m

    public static String indent(String in, String indent) {
        String[] lines = lines(in);
        for (int l = 0; l < lines.length; l++)
            lines[l] = indent + lines[l] + "\r\n";
        return concatenate(lines);
    }

    public static String[] lines(String in) {
        return in.split("\\r?\\n");
    }

    public static String concatenate(String[] lines) {
        String ret = "";
        for (String line : lines)
            ret += line;
        return ret;
    }
}

Related

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