Results 1 to 3 of 3

Thread: Replace a word in a string with given word

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Answers
    1

    Replace a word in a string with given word

    Any one can write the logic for a String is given "this is string" and repalce the word "is" by 'was" and the resultant string be "this was string" and the final string would be palced in same variable.

    How can we replace a word in a string with given word?


  2. #2
    Junior Member
    Join Date
    May 2007
    Answers
    1

    Re: Replace a word in a string with given word

    Quote Originally Posted by naggeek View Post
    Any one can write the logic for a String is given "this is string" and repalce the word "is" by 'was" and the resultant string be "this was string" and the final string would be palced in same variable.

    How can we replace a word in a string with given word?
    we can replace it by doin like this:
    StringBuffer str = new StringBuffer("this is string");
    str.replace(5, 7, "was");
    and then print it


  3. #3
    Junior Member
    Join Date
    Nov 2010
    Answers
    2

    Re: Replace a word in a string with given word

    please can anyone tell me if i have a number 3 stored in a some column of a table and i want to replace that with sting "Excellent",how do i do that?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact