Android String Contain cutWordsAll(String src, String contains)

Here you can find the source of cutWordsAll(String src, String contains)

Description

cut Words All

Declaration

public static String cutWordsAll(String src, String contains) 

Method Source Code

//package com.java2s;

public class Main {
    public static String cutWordsAll(String src, String contains) {
        String result = cutWords(src, contains);
        if (result.indexOf(contains) != -1) {
            return cutWordsAll(result, contains);
        }/*from  w  w w. j av a  2  s.co m*/
        return result;
    }

    public static String cutWords(String src, String contains) {
        int begin = src.indexOf(contains);
        if (begin == -1) {
            return src;
        }
        int end = begin + contains.length();
        String beginStr = "";
        if (begin != 0) {
            beginStr = src.substring(0, begin);
        }
        String endStr = "";
        if (end < src.length()) {
            endStr = src.substring(end);
        }
        return beginStr + endStr;
    }
}

Related

  1. containCount(String str, String searchStr)
  2. contains(String str, String searchStr)
  3. contains(String[] str, String searchStr)
  4. contains(String str, List keywords)
  5. cutWords(String src, String contains)
  6. containsCharRef(String s)
  7. containsIgnoreCase(String str, String query)
  8. contains(String[] components, String value)
  9. containChinese(String s)