def extractStringBetween(inputString,startString, endString):
    if startString != "":
        posStart = inputString.find(startString)
    else:
        posStart = 0

    if posStart == -1:
        return ""

    if endString != "":
        posEnd = inputString.find(endString, posStart+len(startString)) #start searching from posStart
    else:
        posEnd = len(inputString)

    if posEnd == -1:
        return ""

    return inputString[posStart + len(startString):posEnd]

def stringContainsAllSubstrings(inputString, substringList):
    for substring in substringList:
        if inputString.find(substring) == -1:
            return False
    return True

def stringIsInList(inputString, stringList):
    for checkString in stringList:
        if checkString == inputString:
            return True
    return False

def countPattern(filepath, pattern):
    cnt = 0
    file = open(filepath, "r", errors='ignore')
    for line in file.readlines():
        if line.find(pattern) != -1:
            cnt = cnt + 1
    return cnt