Skip to main content
added 5 characters in body
Source Link
LegionMammal978
  • 18k
  • 4
  • 25
  • 57

Mathematica 10.1, 46 bytes

LetterQ@#&&#==ToCamelCase@#&&StringLength@#>1&

Uses one less byte than the standard regex solution. It does three checks. LetterQ@# ensures that the string is entirely composed of letters, and StringLength@#>1 invalidates single-letter strings. #==ToCamelCase@# makes less sense, however. ToCamelCase is an undocumented function I found that takes an input string AndOutputsItLikeThis. Since there is only one word, it will capitalize the first letter, so we check if the string is equal to that.

Mathematica, 46 bytes

LetterQ@#&&#==ToCamelCase@#&&StringLength@#>1&

Uses one less byte than the standard regex solution. It does three checks. LetterQ@# ensures that the string is entirely composed of letters, and StringLength@#>1 invalidates single-letter strings. #==ToCamelCase@# makes less sense, however. ToCamelCase is an undocumented function I found that takes an input string AndOutputsItLikeThis. Since there is only one word, it will capitalize the first letter, so we check if the string is equal to that.

Mathematica 10.1, 46 bytes

LetterQ@#&&#==ToCamelCase@#&&StringLength@#>1&

Uses one less byte than the standard regex solution. It does three checks. LetterQ@# ensures that the string is entirely composed of letters, and StringLength@#>1 invalidates single-letter strings. #==ToCamelCase@# makes less sense, however. ToCamelCase is an undocumented function I found that takes an input string AndOutputsItLikeThis. Since there is only one word, it will capitalize the first letter, so we check if the string is equal to that.

Source Link
LegionMammal978
  • 18k
  • 4
  • 25
  • 57

Mathematica, 46 bytes

LetterQ@#&&#==ToCamelCase@#&&StringLength@#>1&

Uses one less byte than the standard regex solution. It does three checks. LetterQ@# ensures that the string is entirely composed of letters, and StringLength@#>1 invalidates single-letter strings. #==ToCamelCase@# makes less sense, however. ToCamelCase is an undocumented function I found that takes an input string AndOutputsItLikeThis. Since there is only one word, it will capitalize the first letter, so we check if the string is equal to that.