Here you can find the source of rTrim(String s)
public static String rTrim(String s)
//package com.java2s; //License from project: Apache License public class Main { /**/*w w w . j a va2s . c o m*/ * Elimina gli spazi a dx della stringa */ public static String rTrim(String s) { if (s == null) { return null; } else { char c[] = s.toCharArray(); int i = s.length() - 1; while (i >= 0 && c[i] == ' ') { i--; } return s.substring(0, i + 1); } } }