I am attempting to write a simple program, that determines whether the char variable 'sl1' (currently set to 'H' in my program) is in the string variable 'pr_word' (input by the user via a textfield) and, if so, removes that character from the string when the string is output. It also replaces that character with a polygon.
However, at the moment I'm getting the error "no suitable method found for replace(char,String)" and I'm not sure why.
This is the fragment of code that does what I mentioned above: ^
Any help/guidance will be greatly appreciated.
Ulf Dittmer wrote:That means that there is no method with this signature: String.replace(char, String). If you look at the javadocs of the String class you can verify that. You'll need to use some other method that lets you remove or replace characters in a String object.
Thank-You, I've found what I was looking for now.