Java String Remove removePostfixedNewline(String s)

Here you can find the source of removePostfixedNewline(String s)

Description

remove Postfixed Newline

License

Open Source License

Declaration

public static String removePostfixedNewline(String s) 

Method Source Code

//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());
    }
}

Related

  1. removeIllegalXMLChars(String in)
  2. removeImportClass(String className)
  3. removeKeyPrefix(Properties properties, String prefix)
  4. removeModuleReference(String allStr, String refStr)
  5. removeNewLineAndTab(String value)
  6. removeProperty(String name)
  7. removePropertyNameModifier(String name)
  8. removePunctuation(String str)
  9. removePunctuation(String value)