Here you can find the source of removePostfixedNewline(String s)
public static String removePostfixedNewline(String s)
//package com.java2s; import java.util.List; public class Main { public static String removePostfixedNewline(String s) { if (isEmpty(s)) { return s; } else {/* w ww. j av a2s. co m*/ return s.endsWith("\n") ? s.substring(0, s.length() - 1) : s; } } public static boolean isEmpty(String str) { return str == null || "".equals(str.trim()); } public static boolean isEmpty(List list) { return list == null || list.size() == 0; } public static boolean isEmpty(StringBuilder sb) { return sb == null || isEmpty(sb.toString()); } }