>>> 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' >>>
(str_: str)
| 25 | |
| 26 | |
| 27 | def to_simple_case(str_: str) -> str: |
| 28 | """ |
| 29 | >>> to_simple_case("one two 31235three4four") |
| 30 | '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' |
| 37 | """ |
| 38 | string_split = split_input(str_) |
| 39 | return "".join( |
| 40 | ["".join([char.capitalize() for char in sub_str]) for sub_str in string_split] |
| 41 | ) |
| 42 | |
| 43 | |
| 44 | def to_complex_case(text: str, upper: bool, separator: str) -> str: |
no test coverage detected