Hi Arindham,
I have my doubts whether StringBuffer is a suitable object type to accompish your task. As I understand it, you want to replace some URL in a href tag by another.
I would adopt the following strategy:
1. get the original String
2. open an empty StringBuffer
3. scanning the original String for href tags
4. copying the portions not to be modified to the StringBuffer as they are, and replace the portions to be modified by the new content.
Use two int variables, start and end, String methods such as indexOf, substring.
However, this approach can be further optimized towards a better performance. Most String methods, such as string.substring (), create new String objects for their return values. To avoid these unnecessary objects, you may choose to work on a char array, copying the chars one by one to a StringBuffer (or to a second char array). For more information on using char array to
boost performance, use Google with "String" and "performance".
Hope this helps.
[ June 25, 2004: Message edited by: Mag Hoehme ]