List of utility methods to do String Indent Format
void | indent(StringBuilder builder, int indent) indent for (int loop = 0; loop < indent; loop++) { builder.append(" "); |
void | indent(StringBuilder builder, int times) Does the same thing as #indent(int) but appends it directly to string builder. for (int i = 0; i < times; i++) { builder.append(INDENT); |
StringBuilder | indent(StringBuilder sb, int indent) indent return indent(sb, indent, '\t'); |
StringBuilder | indent(StringBuilder sb, int indent) indent for (int i = 0; i < indent; ++i) sb.append(' '); return sb; |
String | indent2(String text, String indent) Indents all but the first line using the given indent string. if (text == null) return ""; int n = text.length(); StringBuilder result = new StringBuilder(n * 2); for (int i = 0; i < n; ++i) { char ch = text.charAt(i); result.append(ch); switch (ch) { ... |
StringBuilder | indentAllLines(String s, String indent) indent All Lines StringBuilder sb = new StringBuilder(); String delimiter = ""; for (String line : s.split("\n")) { sb.append(delimiter).append(indent).append(line); delimiter = "\n"; return sb; |
String | indentation(int howMany) indentation if (howMany > 0) return String.format("%1$" + howMany + "s", " "); else return ""; |
String | indentation(int numberOfIndent) indentation StringBuilder builder = new StringBuilder(); for (int i = 0; i < numberOfIndent; i++) { builder.append("\t"); return builder.toString(); |
int | indentationLevel(CharSequence c) indentation Level int i = 0; while (i < c.length() && c.charAt(i) == ' ') { i++; return i; |
String | indentationStringOfCursorLine(String text, int cursor) indentation String Of Cursor Line int lineStart = startColOfCursorLine(text, cursor); int firstCharAt = lineStart; while (firstCharAt < text.length()) { if (text.charAt(firstCharAt) != ' ') { break; ++firstCharAt; return text.substring(lineStart, firstCharAt); |