diff --git a/xlslu.py b/xlslu.py index 0b9630c..b51c028 100755 --- a/xlslu.py +++ b/xlslu.py @@ -18,7 +18,7 @@ # List Of All Legal Options - Update This When You Add More!!!! ##### -OPTIONSLIST = 'ahv' +OPTIONSLIST = 'achv' #----------------------------------------------------------# @@ -57,6 +57,7 @@ ##### ALLSTRINGS = False +NOCASE = False MATCHSEP = "---> " @@ -113,6 +114,7 @@ "usage: " + PROGNAME + " [-%s]" % optionslist + " file.xls string string string ...", " where,", " -a require all strings to be present (AND matching)", + " -c ignore case when matching", " -h print this help information", " -v print version information", " file.xls name of spreadsheet file to read", @@ -268,6 +270,9 @@ if opt == "-a": ALLSTRINGS = True + if opt == "-c": + NOCASE = True + if opt == "-h": Usage() sys.exit(0) @@ -305,7 +310,16 @@ # Check for matching strings and flag accordingly for matchstring in MATCHSTRINGS: - if value.lower().count(matchstring.lower()): + + # See if user asked for case insensitive matching + + if NOCASE: + value = value.lower() + matchstring = matchstring.lower() + + # Check for matches + + if value.count(matchstring): matched = True matchedstrings[matchstring] = True