def count_leading(data, char):
    """Count number of character (char) in the beginning of string (data) """
    for i in range(len(data)):
        if data[i] != char:
            return i
    return len(data)