Java String Remove removeFillers(String str)

Here you can find the source of removeFillers(String str)

Description

remove Fillers

License

BSD License

Declaration

public static String removeFillers(String str) 

Method Source Code


//package com.java2s;
/*L//from  w  ww. jav  a2s .  c  om
 * Copyright Northrop Grumman Information Technology.
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/nci-mapping-tool/LICENSE.txt for details.
 */

import java.util.*;

public class Main {
    private static Vector filler_vec = null;

    public static String removeFillers(String str) {
        String delim = getDelimiters();
        return removeFillers(str, delim);
    }

    public static String removeFillers(String str, String delim) {
        Vector fillers = getFillers();
        StringTokenizer st = new StringTokenizer(str, delim);
        int knt = 0;
        //String retstr = "";
        StringBuffer buf = new StringBuffer();
        while (st.hasMoreTokens()) {
            String val = st.nextToken();
            if (!fillers.contains(val)) {
                //retstr = retstr + " " + val;
                buf.append(" " + val);
            }
        }
        String retstr = buf.toString();

        retstr = retstr.trim();
        return retstr;
    }

    public static String getDelimiters() {

        return "(-)";
    }

    public static Vector getFillers() {
        return filler_vec;
    }
}

Related

  1. removeCommandFromString(String commandString)
  2. removeEmpties(final String... values)
  3. removeEscape(String s_)
  4. removeExtraSpacesAndSpecialCharacters(String toSearch, boolean setAllToLowerCase)
  5. removeField(BSONObject b, String fieldName)
  6. removeFromSearchPath(String _path)
  7. removeGender(String pos)
  8. removeGenericQuote(String str)
  9. removeIllegalXMLChars(String in)