Here you can find the source of rtrim(String s)
Parameter | Description |
---|---|
s | a parameter |
public static String rtrim(String s)
//package com.java2s; public class Main { /**//from w w w . ja v a 2 s. co m * Trims specified string from right. * @param s */ public static String rtrim(String s) { if (s == null) { return null; } int len = s.length(); int index = len; while (index > 0 && Character.isWhitespace(s.charAt(index - 1))) { index--; } return (index <= 0) ? "" : s.substring(0, index); } }