This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
if i want to search for a name called "raghu" i need to display the whole contents i.e., for example:- if i found raghu in "RameshraghuRakesh" this word has to be displayed either by giving a short name like "rag" or by giving like "%raghu" the whole contents has to be displayed.
Please, help me in this regard, with an example:- I am awaiting for your replies
Please use "code" before posting code; it makes it easier to read.
What you are actually trying to do is to match a regular expression. A little confusingly, you have between you got three regular expressions you wish to match, "raghu", "rag" and "%raghu". Go through the Java Tutorial here. You can probably alter your regular expressions so "raghu" matches anywhere in the Strings and "%raghu" matches the String but not the first position.
Suggest you don't use an unparameterised ArrayList. Better to use a generic list, and use an Iterator rather than a for loop:
Joined: Apr 26, 2007
Thanks for giving the reply ofcourse, i implemented this one but i need to know how i need to get the list of information by typing as %raghu or %rag