Here you can find the source of rtrim(String source)
public static String rtrim(String source)
//package com.java2s; //License from project: Apache License public class Main { public static String rtrim(String source) { return source.replaceAll("\\s+$", ""); }/*from ww w . j av a 2s. c o m*/ }