Text Functions¶
- betterfunctions.textfunctions.count_lines(directory=None, *, count_empty_lines=True, include_hidden=False, ignored_dirs=None, ignored_files=None)¶
Counts the total amount of lines in all Python files in the given directory.
- Parameters:
directory (
str|None) – The directory to count the lines in. Defaults to the current working directory.count_empty_lines (
bool) – Whether to count empty lines. Defaults toTrue.include_hidden (
bool) – Whether to include directories starting with a dot. Defaults toFalse.ignored_dirs (
list[str] |None) – A list of directories to ignore. By default, venv folders and folders starting with a dot are ignored.ignored_files (
list[str] |None) – A list of file patterns to ignore.
- Return type:
- betterfunctions.textfunctions.remove_punctuation(text)¶
Removes punctuation from a given string.
- betterfunctions.textfunctions.replace_substring(text, old, new)¶
Replaces a substring with a new text.
- betterfunctions.textfunctions.reverse_string(s)¶
Reverses a given string.
- betterfunctions.textfunctions.to_camel_case(text)¶
Converts a string to camelcase.
- betterfunctions.textfunctions.to_snake_case(text)¶
Converts a string to snake case.