GeeCON Prague 2014*
The moose likes Applets and the fly likes no suitable method found for replace(char,String) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "no suitable method found for replace(char,String)" Watch "no suitable method found for replace(char,String)" New topic
Author

no suitable method found for replace(char,String)

Hayles Berry
Ranch Hand

Joined: Dec 16, 2012
Posts: 32
Hello.


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
Marshal

Joined: Mar 22, 2005
Posts: 42047
    
  64
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.


Ping & DNS - my free Android networking tools app
Hayles Berry
Ranch Hand

Joined: Dec 16, 2012
Posts: 32
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: no suitable method found for replace(char,String)