Skip to Main Content

New to Java

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!

how to remove words from string

730895Jan 2 2011 — edited Jan 2 2011
hello all!
I am tring to remove words from string.
My example is:
str.replaceAll("\b((and)|(or)|(as)|(so that)|(while)|(at))\b"," ");
[\code]

but it's not working well.
the input:
like but or the love that i ande as want to be as you

and the out put is:
like but or the love that i ande as want to be as you

thanks to all!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 30 2011
Added on Jan 2 2011
3 comments
1,616 views