Skip to content

Commit 12e4016

Browse files
authored
Added doctest to string_switch_case.py (TheAlgorithms#11136)
* Added doctest to string_switch_case.py * Update string_switch_case.py
1 parent fa508d7 commit 12e4016

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: strings/string_switch_case.py

+14
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def to_simple_case(str_: str) -> str:
2828
"""
2929
>>> to_simple_case("one two 31235three4four")
3030
'OneTwo31235three4four'
31+
>>> to_simple_case("This should be combined")
32+
'ThisShouldBeCombined'
33+
>>> to_simple_case("The first letters are capitalized, then string is merged")
34+
'TheFirstLettersAreCapitalizedThenStringIsMerged'
35+
>>> to_simple_case("special characters :, ', %, ^, $, are ignored")
36+
'SpecialCharactersAreIgnored'
3137
"""
3238
string_split = split_input(str_)
3339
return "".join(
@@ -37,6 +43,14 @@ def to_simple_case(str_: str) -> str:
3743

3844
def to_complex_case(text: str, upper: bool, separator: str) -> str:
3945
"""
46+
Returns the string concatenated with the delimiter we provide.
47+
48+
Parameters:
49+
@text: The string on which we want to perform operation
50+
@upper: Boolean value to determine whether we want capitalized result or not
51+
@separator: The delimiter with which we want to concatenate words
52+
53+
Examples:
4054
>>> to_complex_case("one two 31235three4four", True, "_")
4155
'ONE_TWO_31235THREE4FOUR'
4256
>>> to_complex_case("one two 31235three4four", False, "-")

0 commit comments

Comments
 (0)