Case sensitivity explained

In computers, case sensitivity defines whether uppercase and lowercase letters are treated as distinct (case-sensitive) or equivalent (case-insensitive). For instance, when users interested in learning about dogs search an e-book, "dog" and "Dog" are of the same significance to them. Thus, they request a case-insensitive search. But when they search an online encyclopedia for information about the United Nations, for example, or something with no ambiguity regarding capitalization and ambiguity between two or more terms cut down by capitalization, they may prefer a case-sensitive search.

Areas of significance

Case sensitivity may differ depending on the situation:

In programming languages

Some programming languages are case-sensitive for their identifiers (C, C++, Java, C#, Verilog,[3] Ruby,[4] Python and Swift). Others are case-insensitive (i.e., not case-sensitive), such as ABAP, Ada, most BASICs (an exception being BBC BASIC), Common Lisp, Fortran, SQL (for the syntax, and for some vendor implementations, e.g. Microsoft SQL Server, the data itself)[5] Pascal, Rexx and ooRexx. There are also languages, such as Haskell, Prolog, and Go, in which the capitalisation of an identifier encodes information about its semantics. Some other programming languages have varying case sensitivity; in PHP, for example, variable names are case-sensitive but function names are not case-sensitive. This means that if a function is defined in lowercase, it can be called in uppercase, but if a variable is defined in lowercase, it cannot be referred to in uppercase. Nim is case-insensitive and ignores underscores, as long as the first characters match.[6]

In text search

A text search operation could be case-sensitive or case-insensitive, depending on the system, application, or context. The user can in many cases specify whether a search is sensitive to case, e.g. in most text editors, word processors, and Web browsers. A case-insensitive search is more comprehensive, finding "Language" (at the beginning of a sentence), "language", and "LANGUAGE" (in a title in capitals); a case-sensitive search will find the computer language "BASIC" but exclude most of the many unwanted instances of the word. For example, the Google Search engine is basically case-insensitive, with no option for case-sensitive search.[7] In Oracle SQL most operations and searches are case-sensitive by default,[8] while in most other DBMS's SQL searches are case-insensitive by default.[9]

Case-insensitive operations are sometimes said to fold case, from the idea of folding the character code table so that upper- and lowercase letters coincide.

In filesystems

In filesystems in Unix-like systems, filenames are usually case-sensitive (there can be separate readme.txt and Readme.txt files in the same directory). MacOS is somewhat unusual in that, by default, it uses HFS+ and APFS in a case-insensitive (so that there cannot be a readme.txt and a Readme.txt in the same directory) but case-preserving mode (so that a file created as readme.txt is shown as readme.txt and a file created as Readme.txt is shown as Readme.txt) by default. This causes some issues for developers and power users, because most file systems in other Unix-like environments are case-sensitive, and, for example, a source code tree for software for Unix-like systems might have both a file named Makefile and a file named makefile in the same directory. In addition, some Mac Installers assume case insensitivity and fail on case-sensitive file systems.

The older MS-DOS filesystems FAT12 and FAT16 were case-insensitive and not case-preserving, so that a file whose name is entered as readme.txt or ReadMe.txt is saved as README.TXT. Later, with VFAT in Windows 95 the FAT file systems became case-preserving as an extension of supporting long filenames.[10] Later Windows file systems such as NTFS are internally case-sensitive, and a readme.txt and a Readme.txt can coexist in the same directory. However, for practical purposes filenames behave as case-insensitive as far as users and most software are concerned.[11] This can cause problems for developers or software coming from Unix-like environments, similar to the problems with macOS case-insensitive file systems.

Notes and References

  1. The link "Friendly Fire" must go through the (disambiguation) qualifier in a Wikipedia article to avoid a error.
  2. See
  3. Book: Kernighan . Brian W. . Brian Kernighan . Ritchie . Dennis M. . Dennis Ritchie . Chapter 2: Types, Operators and Expressions . 33 . . 1st . Prentice Hall . February 1978 . Englewood Cliffs, NJ . 0-13-110163-3 .
  4. Book: Matsumoto, Yukihiro . Yukihiro Matsumoto . Chapter 2: Language Basics . 9 . Ruby in a nutshell . 1st . O'Reilly Media . January 2002 . 0-596-00214-9 . https://archive.org/details/rubyinnutshellde00mats/page/9 .
  5. Although one can explicitly set a single database or column collation to be case-sensitive
  6. Web site: Nim Manual: Identifier Equality. nim-lang.github.io. 2019-04-27.
  7. Web site: case-sensitive-search - case sensitive google search - Google Project Hosting . code.google.com . 2013-05-20.
  8. Book: Oracle SQL Developer User's Guide, Release 1.5. 2.10 Making Queries Case Insensitive. August 2013. Oracle Corporation.
  9. Web site: C.5.5.1 Case Sensitivity in String Searches . MySQL 5.0 Reference Manual . MySQL . 2013-05-20.
  10. Web site: Case Sensitivity in Subsystem for UNIX-based Applications . Microsoft Learn . 2005-08-22 . 2013-05-20.
  11. Web site: Filenames are Case Sensitive on NTFS Volumes . Microsoft Support . 2006-11-01 . dead . https://web.archive.org/web/20130723020137/http://support.microsoft.com/kb/100625 . Jul 23, 2013 . 2013-05-20.