Here you can find the source of indented(String indenter, String s)
Parameter | Description |
---|---|
indenter | a parameter |
s | a parameter |
public static String indented(String indenter, String s)
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w . ja v a2s .c o m * This method doesn't honor consecutive \n's unless they're separated. * So, use "\n \n" instead of "\n\n" to get a blank line. * @param indenter * @param s * @return */ public static String indented(String indenter, String s) { String[] sArr = s.split("\n"); String result = ""; for (String currLine : sArr) { result += indenter + currLine + "\n"; } return result; } }