Java String Trim Right rtrim(String str, String suffixs)

Here you can find the source of rtrim(String str, String suffixs)

Description

rtrim

License

Apache License

Declaration

public static String rtrim(String str, String suffixs) 

Method Source Code

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

Related

  1. rtrim(String str)
  2. rtrim(String str)
  3. rtrim(String str)
  4. rtrim(String str, String charList)
  5. rtrim(String str, String defaultValue)
  6. rtrim(String string, String end)
  7. rtrim(String text, char c)
  8. rTrim(String value)
  9. rtrim(String value, int maxLength)