Java String Trim Right rTrim(String s)

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

Description

Purpose:
rTrim

License

Open Source License

Parameter

Parameter Description
s a parameter

Return


Declaration

public static String rTrim(String s) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   w ww.j a v  a  2 s  .  c om
     * Purpose:
     * <br>
     * rTrim<br>
     * <br>
     * @param s
     * @return<br>
     */
    public static String rTrim(String s) {
        int i = s.length() - 1;
        while (i >= 0 && Character.isWhitespace(s.charAt(i))) {
            i--;
        }
        return s.substring(0, i + 1);
    }
}

Related

  1. rtrim(String orig)
  2. rtrim(String pString)
  3. rtrim(String s)
  4. rtrim(String s)
  5. rtrim(String s)
  6. rtrim(String s)
  7. rtrim(String s)
  8. rtrim(String s)
  9. rtrim(String s)