Ad
  • Default User Avatar

    Isn't an underscore a punctuation character?

  • Default User Avatar

    Having completed this task in Java, I discovered my solution considered 2 edge cases that had no test cases:

    1. To me, camel case only has upper case characters on the first letter of each word, but there is no verification that any uppercase characters in non-first letters of words are lower-cased, and I can see a number of solutions that do not modify the casing of the first word at all (where all characters but the first should be verified as lower case for a valid answer according to my definition). Note in particular, I consider switching from camel case to snake case a reversible operation, but permitting uppercase character mid-word breaks the transformation. That is, the_next_word-breakS -> theNextWordBreaks is reversible in future operations (other than the de-capitalisation of the last s which will be lost), -> theNextWordBreakS is not.
    2. There is no specification or verification of what should happen if the input starts with one or more delimiters - are you supposed to consider the empty prefix the "first word" (and therefore force capitalisation of the first "non-empty word") or treat all "empty words" as "not words" for the sake of determining where the first word begins? That is, should -_hello_world_- transform to helloWorld (as I would expect) or HelloWorld (because the "first word" was empty)?