Your task is to write a program that performs case conversion from plain text, and other case formats, into one of the specified formats below. Inputs will be either plain lowercase text, or one of the detailed cases below. You must remove non-alphabetic characters except
(space), _
(underscore) and -
(hyphen), then split the string into words by the locations of
/_
/-
and places where two adjacent characters have different cases (e.g. bA
). Then change the capitalization of each word and join the words on some delimiting character. The specifics of capitalization and delimiter depend on the case conversion chosen.
Your program must be a polyglot in at least two different languages. For example, running your code in Python 2 transforms input to snake_case
, running it in JavaScript transforms to kebab-case
, Ruby transforms to PascalCase
and 05AB1E transforms to camelCase
.
Tasks
The following case conversions can be completed:
Case | Capitalization | Delimiter |
---|---|---|
camelCase | First word should be all lowercase; the rest should be all lowercase except for the first letter, which should be uppercase. | None |
PascalCase | The first letter of each word should be uppercase, the rest lowercase. | None |
snake_case | Words should be all lowercase. | _ |
UPPER_SNAKE_CASE | Words should be all uppercase. | _ |
kebab-case | Words should be all lowercase. | - |
camelCase
this is a test thisIsATest
camelCaseTest camelCaseTest
PascalCaseTest pascalCaseTest
snake_case_test snakeCaseTest
kebab-case-test kebabCaseTest
testing!!one!!!1!!! testingOne1
aBCDef aBCDef
ABCDef aBCDef
a_b_c_def aBCDef
a-b-c-def aBCDef
PascalCase
this is a test ThisIsATest
camelCaseTest CamelCaseTest
PascalCaseTest PascalCaseTest
snake_case_test SnakeCaseTest
kebab-case-test KebabCaseTest
testing!!one!!!1!!! TestingOne1
aBCDef ABCDef
ABCDef ABCDef
a_b_c_def ABCDef
a-b-c-def ABCDef
snake_case
this is a test this_is_a_test
camelCaseTest camel_case_test
PascalCaseTest pascal_case_test
snake_case_test snake_case_test
kebab-case-test kebab_case_test
testing!!one!!!1!!! testing_one_1
aBCDef a_b_c_def
ABCDef a_b_c_def
a_b_c_def a_b_c_def
a-b-c-def a_b_c_def
UPPER_SNAKE_CASE / SCREAMING_SNAKE_CASE
this is a test THIS_IS_A_TEST
camelCaseTest CAMEL_CASE_TEST
PascalCaseTest PASCAL_CASE_TEST
snake_case_test SNAKE_CASE_TEST
kebab-case-test KEBAB_CASE_TEST
testing!!one!!!1!!! TESTING_ONE_1
aBCDef A_B_C_DEF
ABCDef A_B_C_DEF
a_b_c_def A_B_C_DEF
a-b-c-def A_B_C_DEF
kebab-case
this is a test this-is-a-test
camelCaseTest camel-case-test
PascalCaseTest pascal-case-test
snake_case_test snake-case-test
kebab-case-test kebab-case-test
testing!!one!!!1!!! testing-one-1
aBCDef a-b-c-def
ABCDef a-b-c-def
a_b_c_def a-b-c-def
a-b-c-def a-b-c-def
Rules
- Your code should produce the same output as the linked examples.
- Entries with the most conversions in each language win, with code length being a tie-breaker.
Testing!!one!!!1!!!
doesn't seem to apply to this? \$\endgroup\$