philh_myftp_biz.text

Submodules

Package Contents

Functions

split

Automatic String Splitter

int_stripper

Remove all non-numerical characters from an alphanumeric string

auto_convert

Automatically convert string

random

Get a string with random characters

similarity

Get the percentage of how similar two strings are

abbr

to_slice

Parse a string into a list of slices or integers

API

philh_myftp_biz.text.split(value: str, sep: str = None) list[str]

Automatic String Splitter

If sep is None, then shlex.split is used. If sep is defined, then str.split is used

philh_myftp_biz.text.int_stripper(string: str) None | int

Remove all non-numerical characters from an alphanumeric string

philh_myftp_biz.text.auto_convert(string: str) int | float | bool | dict | str

Automatically convert string

Input Types:
  • int

  • float

  • bool

  • hex (dill)

  • dict

  • str

philh_myftp_biz.text.random(length: int) str

Get a string with random characters

Ex: random(6) -> ‘JAIOEN’

philh_myftp_biz.text.similarity(a: str, b: str) float

Get the percentage of how similar two strings are

Ex: similarity(‘hi’, ‘hi’) -> 1.0

philh_myftp_biz.text.abbr(num: int, string: str, inclusive: bool = True, end: str = '...') str
philh_myftp_biz.text.to_slice(string: str) None | list[slice | int]

Parse a string into a list of slices or integers

EXAMPLES: ` '.'    : [:] '7'    : 7 '..3'  : [:4] '5..'  : [5:] '3..5' : [3:6] '1,3'  : 1, 3 `