Replace/remove character in a String
Code:
String tmpString = myString.replace( '\'', '*' );
System.out.println( "Original = " + myString );
System.out.println( "Result = " + tmpString );
So in this project I am trying to get a string from the user using the Scanner, and use that string, then replace certain letters with others and print it out. Above is a section of a tutorial I found on the web, but i am having trouble setting this up for myself. I am using the replace statement for this. Can someone please help me out with how to set this up and takes the user's string and replace? And are there any other statements that I might be able to use to aid in this process?
Thanks you a lot for any help. I really appreciate it. I am an amateur at this and am trying to learn.
Re: Replace/remove character in a String
You really need to make a good faith effort to try to solve this yourself first and then ask specific questions about problems with your code. Also, you should avoid borrowing any code from the internet if you don't understand it.