11
\$\begingroup\$

Since this isn't explicitly codified anywhere, and was sparked by discussion surrounding my recent challenge, I figured I'd bring it up here for consensus before modifying the tag.

Related:

The Question

When a challenge asks for a string, what should the default case-sensitivity be?

\$\endgroup\$

1 Answer 1

33
\$\begingroup\$

Unless specified otherwise, strings are case-sensitive. More generally, unless specified otherwise, strings are just sequences of characters with no semantics attached to any specific characters.

This should also be the least surprising default for users who are not aware of this post.

I'd also urge challenge authors to think twice before making a challenge case-insensitive. We've done case insensitivity more than often enough, and most of the time it's a concern that's completely orthogonal to the actual task of the challenge, and it just adds extra code for handling the case-insensitivity which adds nothing at all to the answers. Related reading.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ This answer hits the nail on the head. If you think about strings as sequence of bytes in a particular encoding, case-insensitivity makes no sense. While whether or not "A" == "a" could be questioned, no reasonable person would think 0x41 == 0x61. \$\endgroup\$
    – user45941
    Jul 2, 2016 at 0:01
  • \$\begingroup\$ May you bold the "it just adds extra code" so at a glance it's clear what your stance is on this? \$\endgroup\$
    – Downgoat
    Jul 8, 2016 at 3:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .