remove End - Java java.lang

Java examples for java.lang:String Strip

Description

remove End

Demo Code


//package com.java2s;

public class Main {
    public static String removeEnd(String string, String suffix) {
        if (string.endsWith(suffix)) {
            return string.substring(0, string.length() - suffix.length());
        }/*w  w w.  j av  a2 s  . co m*/
        return string;
    }
}

Related Tutorials