delete Last character from a string - Android java.lang

Android examples for java.lang:Character

Description

delete Last character from a string

Demo Code


public class Main{

    public static final String deleteLast(String str, int num) {
        if (str == null)
            return null;
        return str.substring(0, str.length() - num);
    }//ww  w.j  a  va 2 s.c  om

}

Related Tutorials