Here you can find the source of rtrim(String str, String suffixs)
public static String rtrim(String str, String suffixs)
//package com.java2s; //License from project: Apache License public class Main { public static String rtrim(String str, String suffixs) { if (isNull(str) || isNull(suffixs)) return str; int i = str.length() - 1; for (; i >= 0; i--) { if (suffixs.indexOf(str.charAt(i)) == -1) break; }// w w w .j a va 2 s. c o m return str.substring(0, i + 1); } public static boolean isNull(Object s) { if (s == null || s.toString().trim().length() == 0 || s.equals("null")) return true; else return false; } }