MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / to_kebab_case

Function to_kebab_case

strings/string_switch_case.py:111–118  ·  view source on GitHub ↗

>>> to_kebab_case("one two 31235three4four", True) 'ONE-TWO-31235THREE4FOUR' >>> to_kebab_case("one two 31235three4four", False) 'one-two-31235three4four'

(text: str, upper: bool)

Source from the content-addressed store, hash-verified

109
110
111def to_kebab_case(text: str, upper: bool) -> str:
112 """
113 >>> to_kebab_case("one two 31235three4four", True)
114 'ONE-TWO-31235THREE4FOUR'
115 >>> to_kebab_case("one two 31235three4four", False)
116 'one-two-31235three4four'
117 """
118 return to_complex_case(text, upper, "-")
119
120
121if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

to_complex_caseFunction · 0.85

Tested by

no test coverage detected