Java examples for java.lang:StringBuilder
append In New Line to StringBuilder
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { StringBuilder out = new StringBuilder(); String name = "java2s.com"; String text = "java2s.com"; appendInNewLine(out, name, text); }/*from www . ja v a2 s . c om*/ public static void appendInNewLine(StringBuilder out, String name, String text) { appendInNewLine(out, name, text, ""); } public static void appendInNewLine(StringBuilder out, String name, String text, String suffix) { if (text.isEmpty()) return; if (out.length() > 0) out.append("\n"); out.append(name).append(": ").append(text).append(suffix); } }