Java String Trim Right rtrim(String source)

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

Description

remove trailing whitespace

License

LGPL

Parameter

Parameter Description
source a parameter

Return

string without trailing whitespace

Declaration

public static String rtrim(String source) 

Method Source Code

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

public class Main {
    /**/*ww w.  j  a  va2s .c  o  m*/
     * remove trailing whitespace
     * 
     * @param source
     * @return string without trailing whitespace
     */
    public static String rtrim(String source) {
        return source.replaceAll("\\s+$", "");
    }
}

Related

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