Java tutorial
//package com.java2s; import java.util.Arrays; public class Main { public static String stripCharacters(String in, char[] character) { if (in == null || ("".equals(in))) return ""; StringBuffer out = new StringBuffer(); char current; for (int i = 0; i < in.length(); i++) { current = in.charAt(i); if (Arrays.binarySearch(character, current) < 0) { out.append(current); } } return out.toString(); } }