textcase.convert()#
textcase.convert #
convert(text, case, boundaries=DEFAULT_BOUNDARIES)
Convert the given text to the specified case format.
PARAMETER | DESCRIPTION |
---|---|
text | The input string to be converted. TYPE: |
case | The case format to convert the text to, which should be an instance of TYPE: |
boundaries | A collection of Boundary instances that define the split conditions. TYPE: |
RETURNS | DESCRIPTION |
---|---|
str | The input string converted to the specified case format. TYPE: |
Examples:
>>> assert convert("2020-04-16_my_cat_cali", case.SNAKE) == "2020_04_16_my_cat_cali"
>>> assert convert("my_Cat-CALI", case.CAMEL) == "myCatCali"