Here you can find the source of remove(String str, char remove)
public static String remove(String str, char remove)
//package com.java2s; public class Main { public static String remove(String str, char remove) { if (isEmpty(str) || str.indexOf(remove) == -1) { return str; }/*from w w w . j a v a 2s. c o m*/ char[] chars = str.toCharArray(); int pos = 0; for (int i = 0; i < chars.length; i++) { if (chars[i] != remove) { chars[pos++] = chars[i]; } } return new String(chars, 0, pos); } public static boolean isEmpty(String str) { return str == null || str.length() == 0; } public static int indexOf(String str, String searchStr) { if (str == null || searchStr == null) { return -1; } return str.indexOf(searchStr); } }