-
wild card matching for desktop search
hello all,
i'm asking for help once again in developing my search engine. i want to add the feature of wildcard matching in my desktop search. if a user enters *.txt as input, the search results should contain all the files which have a .txt extension. also, if a user enters sha* as input, the results should display all the files starting from sha. can anyone please help me out with this issue? i have no idea by which this can be implemented. hoping for an early reply.
regards,
djshanx.
-
If you are looking to filter by file names, including extension, look at the java.io.FileFilter and java.io.FilenameFilter interfaces and javax.swing.filechooser.FileFilter class (if you are using a Swing filechooser).
Your wildcard input "contains" could be a part of your coding of your implementation of the FilenameFilter, the only method of which returns a boolean value indicating whether or not the given filename should be accepted (added to the list of files), based on the rules you define. You could use a Pattern, generated from the input, to test this.
Similar Threads
-
By thomastl in forum Java
Replies: 1
Last Post: 03-29-2009, 11:49 AM
-
By thomastl in forum Java
Replies: 4
Last Post: 01-22-2007, 02:45 AM
-
Replies: 17
Last Post: 05-24-2006, 06:13 AM
-
By Dark Rain in forum Java
Replies: 2
Last Post: 11-06-2005, 04:45 PM
-
By Larry Serflaten in forum Talk to the Editors
Replies: 3
Last Post: 07-16-2001, 02:30 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks