# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/09_strs.ipynb.

# %% auto 0
__all__ = ['snakecase', 'prepart', 'midpart', 'endpart']

# %% ../nbs/09_strs.ipynb 6
import re

# %% ../nbs/09_strs.ipynb 8
#| export


# %% ../nbs/09_strs.ipynb 11
#| export

# %% ../nbs/09_strs.ipynb 13
#| export


# %% ../nbs/09_strs.ipynb 15
#| export


# %% ../nbs/09_strs.ipynb 17
#| export


# %% ../nbs/09_strs.ipynb 19
from nchr import U1, SPACE
from quac import strq

# %% ../nbs/09_strs.ipynb 21
from .cons import WORDS_TO_SNAKE_WITH_UPPERCASE

# %% ../nbs/09_strs.ipynb 23
def snakecase(s: str) -> str:
    '''Convert a string to snake_case'''
    matches = re.findall(WORDS_TO_SNAKE_WITH_UPPERCASE, s)
    return U1.join(matches).lower()

# %% ../nbs/09_strs.ipynb 24
def prepart(s: str, sep: strq = SPACE) -> str:
    pre, *_ = s.partition(sep)
    return pre

def midpart(s: str, sep: strq = SPACE) -> str:
    _, mid, _ = s.partition(sep)
    return mid

def endpart(s: str, sep: strq = SPACE) -> str:
    *_, end = s.partition(sep)
    return end

# %% ../nbs/09_strs.ipynb 26
#| export
