Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Replace a word in a string with given word

This is a discussion on Replace a word in a string with given word within the Java forums, part of the Software Development category; 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 ...

Go Back   Geeks Talk > Software Development > Java
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Java Java related Issues and Problems

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-21-2007
Junior Member
 
Join Date: Apr 2007
Location: pune
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
naggeek is on a distinguished road
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?
Reply With Quote
The Following User Says Thank You to naggeek For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 07-22-2007
Junior Member
 
Join Date: May 2007
Location: delhi
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sarika234 is on a distinguished road
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
Reply With Quote
Reply

  Geeks Talk > Software Development > Java

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
what is the word ? psuresh1982 Brainteasers 11 01-17-2007 07:10 AM
which word fits here? vmshenoy Brainteasers 7 01-12-2007 08:10 AM
english word.... psuresh1982 Brainteasers 5 12-14-2006 02:35 AM
Spell the Word janelyn Brainteasers 3 09-16-2006 03:23 PM
Find out the odd word Remasri Brainteasers 1 08-23-2006 04:57 PM


All times are GMT -4. The time now is 02:35 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved