wild card matching for desktop search


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: wild card matching for desktop search

  1. #1
    Join Date
    May 2006
    Posts
    4

    Question 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.

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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

  1. Replies: 1
    Last Post: 03-29-2009, 11:49 AM
  2. Replies: 4
    Last Post: 01-22-2007, 02:45 AM
  3. Replies: 17
    Last Post: 05-24-2006, 06:13 AM
  4. Card game troubles
    By Dark Rain in forum Java
    Replies: 2
    Last Post: 11-06-2005, 04:45 PM
  5. Beef up that search engine!
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center