Skip to content

Strings

slugify()

Convert a string to a URL-friendly slug.

Arguments

Argument Description Default
value The string to slugify [none]
allow_unicode If True, allow unicode characters False

Example

from tna_utilities.string import slugify

print(slugify("TNA Python Utilities Docs"))
# tna-python-utilities-docs

unslugify()

Convert a slug back to a human-readable string.

Arguments

Argument Description Default
slug The slug to unslugify [none]
capitalize_first If True, capitalise the first character True

Example

from tna_utilities.string import unslugify

print(unslugify("tna-python-utilities-docs"))
# Tna python utilities docs