问题
In Java, Following code is one way to achieve.
StringBuilder result = new StringBuilder();
result.append(someChar);
result.append("\n");
A better way to do it in kotlin?
回答1:
Kotlin 1.3+ provides Extension Function to ease the task.
Usage:
val strBuilder = StringBuilder();
strBuilder.appendln("some text");
来源:https://stackoverflow.com/questions/57705138/how-to-append-a-new-line-to-stringbuilder-in-kotlin