Remove all occurrences of char from string September 26, 2022 by Tarik Try using the overload that takes CharSequence arguments (eg, String) rather than char: str = str.replace("X", "");