String Find
Note:
- Currently find is case-insensitive. Everything will be compared with lowercase.
- Added Github Action and Pre-commit for Pylint Check (Using Black - https://black.readthedocs.io/en/stable/).
- Pytest for testing.
Todo:
- Improvements needed for error handling, eg:- If integer passed instead of string, it will give error.
- Optimization might be needed for large datasets.
Install Poetry
$ pip install poetry
or
$ pip3 install poetry
Activate or Create Env
$ poetry shell
Install Packages from Poetry
$ poetry install
from string_find import find
from string_find_cls import Find
data = ["helloworld", "foo", "bar", "stylight_team", "seo"]
query = "eos"
# Function Usage
result = find(data, query)
print(result) # ["seo"]
# Class Usage
result = Find(data, query)
print(result) # ["seo"]
# Class Different Usage
result = StringFind(data, query).find()
print(result) # ["seo"]
$ pytest
- Python: 3.8+