Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Default Replace/remove character in a String

    Java 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.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default 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.

Similar Threads

  1. String.replace ?!
    By HearT.Hunt3r in forum New To Java
    Replies: 4
    Last Post: 08-22-2011, 04:04 AM
  2. Java String Replace
    By aham in forum New To Java
    Replies: 4
    Last Post: 05-17-2011, 09:46 AM
  3. Replace String
    By Raeghin in forum New To Java
    Replies: 1
    Last Post: 07-28-2009, 04:58 PM
  4. Doing the lucene remove character \n
    By farnetani in forum Lucene
    Replies: 4
    Last Post: 02-13-2009, 11:10 AM
  5. String replace method
    By venkata.tarigopula in forum Advanced Java
    Replies: 1
    Last Post: 07-10-2007, 09:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •