Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

String replace

807589Jan 13 2009 — edited Jan 13 2009
Hi

I just want to replace a line with a word irrespective of its case.

For Example:

String line="Have A Nice Day";

if i replace "a" with "aaaa";
i want the output as,
Haaaave aaaa Nice Daaaay;

so that lower case "a" and upper case "a" is replaced with "aaaa". And all other characters must remain in the same case.

i tried using replace function but it replace only respective to case.

Plz help me.

Rgds
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 10 2009
Added on Jan 13 2009
2 comments
154 views