trim one string from another string - Android java.lang

Android examples for java.lang:String Strip

Description

trim one string from another string

Demo Code

import android.text.SpannableString;
import android.text.style.URLSpan;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class Main{

    public static String trim(String s, String s1) {
            for (; s.endsWith(s1); s = s.substring(0, s.length() - s1.length())) {
            }//w  ww  .  j a  va2s.  c o m
            for (; s.startsWith(s1); s = s.substring(s1.length(), s.length())) {
            }
            return s;
        }

}

Related Tutorials