This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Hi, I'm starting to create an address book, but am not aware of how to create a 'Search' field, like a normal gui address book. I am thinking that I should just check the first letter of the last name (which I'm not sure how to do either) and then just put each address in that particular unit (i.e. the Dan Silva would be in the 'S' class, and so on). If anyone can point me in the right direction for these, that would be great.
The simplest search might require exact matches, just a String equals
String has some methods that might make things more fun. You might try
to find "il" in "Silva"
Probably next up the complexity ladder is regular expressions. If you've never used them, this might be a good excuse to learn. See the JavaDoc for Pattern and Google for "Sun tutorial regular expressions" to find more how-to.
For a journey into some pretty cool objects and algorithms, a Ternary Search Tree is a great way to do "autocomplete" things, so typing "S" might suggest "Silva" and "Smith" and "Si" would narrow down to just "Silva".
Think about doing all your compares on lower-cased strings to help your chances.
Any of those match your current skills & comfort?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi