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?
Re: Replace a word in a string with given word
[QUOTE=naggeek;15494]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?[/QUOTE]
we can replace it by doin like this:
StringBuffer str = new StringBuffer("this is string");
str.replace(5, 7, "was");
and then print it
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?