Try using the overload that takes CharSequence
arguments (eg, String
) rather than char
:
str = str.replace("X", "");
More Related Contents:
- Java – how to replace duplicated characters in a string? [closed]
- Replace a character at a specific index in a string?
- What is the easiest/best/most correct way to iterate through the characters of a string in Java?
- Java String remove all non numeric characters but keep the decimal separator
- How can I check if a single character appears in a string?
- How to compare character ignoring case in primitive types
- Converting String to “Character” array in Java
- Creating Unicode character from its number
- How to determine if a String has non-alphanumeric characters?
- Java: How to split a string by a number of characters?
- Need some advice on split() method in Java [closed]
- String concatenation in Java – when to use +, StringBuilder and concat [duplicate]
- In Java, is there a way to write a string literal without having to escape quotes?
- How to convert a char array back to a string?
- How to remove line breaks from a file in Java?
- How can I get the size of an array, a Collection, or a String in Java?
- Redirect console output to string in Java
- Getting strange output when printing result of a string comparison
- Why is String immutable in Java?
- java.lang.IllegalStateException: Scanner closed
- Extract time from date String
- Java String Scanner input does not wait for info, moves directly to next statement. How to wait for info? [duplicate]
- String concatenation containing Arabic and Western characters
- How to check a string against null in java?
- Converting a sentence string to a string array of words in Java
- What is the character encoding of String in Java?
- How to create variables dynamically in Java? [closed]
- substring index range
- How to replace a substring of a string [duplicate]
- How do I get the last character of a string?