Java String Trim Right rtrim(String str)

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

Description

rtrim

License

Open Source License

Declaration

public static String rtrim(String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String rtrim(String str) {
        int i = str.length();
        while (i > 0) {
            switch (str.charAt(i - 1)) {
            case ' ':
            case '\t':
                i--;//from w  w w . java  2 s .  c o m
                continue;
            }
            break;
        }
        return str.substring(0, i);
    }
}

Related

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