Java String Trim Right rTrim(String s)

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

Description

Elimina gli spazi a dx della stringa

License

Apache License

Declaration

public static String rTrim(String s) 

Method Source Code

//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);
        }
    }
}

Related

  1. rtrim(String s)
  2. rtrim(String s)
  3. rtrim(String s)
  4. rtrim(String s)
  5. rtrim(String s)
  6. rtrim(String s, char character)
  7. rtrim(String s, char character)
  8. rtrim(String s, Character c)
  9. rtrim(String source)