Show
Ignore:
Timestamp:
02/27/03 10:09:20 (21 years ago)
Author:
jalet
Message:

Added a method to match strings against wildcard patterns

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/tool.py

    r804 r817  
    1515# 
    1616# $Log$ 
     17# Revision 1.22  2003/02/27 09:09:20  jalet 
     18# Added a method to match strings against wildcard patterns 
     19# 
    1720# Revision 1.21  2003/02/17 23:01:56  jalet 
    1821# Typos 
     
    9396import sys 
    9497import os 
     98import fnmatch 
    9599import getopt 
    96100import smtplib 
     
    211215                    return 0 
    212216            return 1         
     217        return 0 
     218         
     219    def matchString(self, s, patterns) : 
     220        """Returns 1 if the string s matches one of the patterns, else 0.""" 
     221        for pattern in patterns : 
     222            if fnmatch.fnmatchcase(s, pattern) : 
     223                return 1 
    213224        return 0 
    214225