Java String Trim Right rtrim(String str)

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

Description

rtrim

License

Apache License

Declaration

public static String rtrim(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String rtrim(String str) {
        int start = str.length() - 1;
        for (int i = start; i >= 0; i--) {
            char c = str.charAt(i);
            if (c != ' ' && c != '\t') {
                return i != start ? str.substring(0, i + 1) : str;
            }/*from   w ww .  j  a  va 2s.co  m*/
        }
        return "";
    }
}

Related

  1. rtrim(String source)
  2. rtrim(String source)
  3. rtrim(String src, char ch, int nLen)
  4. rtrim(String str)
  5. rtrim(String str)
  6. rtrim(String str)
  7. rtrim(String str)
  8. rTrim(String str)
  9. rtrim(String str)