replace Suffix - Android java.lang

Android examples for java.lang:String Starts or Ends

Description

replace Suffix

Demo Code


public class Main{

    public static String replaceSuffix(String base, String target,
            String replacement) {
        return base.substring(0, base.lastIndexOf(target)) + replacement;
    }/*from   w w  w .j  ava2s .  co  m*/

}

Related Tutorials