From 0acc01fed19b7e49a12c1f59d1c0d358c9058ab8 Mon Sep 17 00:00:00 2001 From: Suyash Dongre <109069262+Suyashd999@users.noreply.github.com> Date: Thu, 2 Nov 2023 22:51:23 +0530 Subject: [PATCH 1/2] Added doctest to string_switch_case.py --- strings/string_switch_case.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/strings/string_switch_case.py b/strings/string_switch_case.py index 9a07472dfd71..2aa63dbc8fe6 100644 --- a/strings/string_switch_case.py +++ b/strings/string_switch_case.py @@ -28,6 +28,12 @@ def to_simple_case(str_: str) -> str: """ >>> to_simple_case("one two 31235three4four") 'OneTwo31235three4four' + >>> to_simple_case("This should be combined") + 'ThisShouldBeCombined' + >>> to_simple_case("The first letters are capitalized, then string is merged") + 'TheFirstLettersAreCapitalizedThenStringIsMerged' + >>> to_simple_case("special characters :, ', %, ^, $, are ignored") + 'SpecialCharactersAreIgnored' """ string_split = split_input(str_) return "".join( @@ -37,6 +43,14 @@ def to_simple_case(str_: str) -> str: def to_complex_case(text: str, upper: bool, separator: str) -> str: """ + Returns the string concatenated with the delimeter we provide. + + Parameters: + @text: The string on which we want to perform operation + @upper: Boolean value to determine whether we want capitalized result or not + @separator: The delimeter with which we want to concatenate words + + Examples: >>> to_complex_case("one two 31235three4four", True, "_") 'ONE_TWO_31235THREE4FOUR' >>> to_complex_case("one two 31235three4four", False, "-") From ca59c82f15ca7db94fb38be08dd9e14e2913ede0 Mon Sep 17 00:00:00 2001 From: Suyash Dongre <109069262+Suyashd999@users.noreply.github.com> Date: Thu, 2 Nov 2023 22:56:23 +0530 Subject: [PATCH 2/2] Update string_switch_case.py --- strings/string_switch_case.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strings/string_switch_case.py b/strings/string_switch_case.py index 2aa63dbc8fe6..c16d9fa552f9 100644 --- a/strings/string_switch_case.py +++ b/strings/string_switch_case.py @@ -43,12 +43,12 @@ def to_simple_case(str_: str) -> str: def to_complex_case(text: str, upper: bool, separator: str) -> str: """ - Returns the string concatenated with the delimeter we provide. + Returns the string concatenated with the delimiter we provide. Parameters: @text: The string on which we want to perform operation @upper: Boolean value to determine whether we want capitalized result or not - @separator: The delimeter with which we want to concatenate words + @separator: The delimiter with which we want to concatenate words Examples: >>> to_complex_case("one two 31235three4four", True, "_")