
In computers,case sensitivity defines whetheruppercase and lowercase letters are treated as distinct (case-sensitive) or equivalent (case-insensitive). For instance, when users interested in learning about dogs search ane-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.
Case sensitivity may differ depending on the situation:
Someprogramming languages are case-sensitive for their identifiers (C,C++,Java,C#,Verilog,[2]Ruby,[3]Python andSwift). Others are case-insensitive (i.e., not case-sensitive), such asABAP,Ada, mostBASICs (an exception beingBBC BASIC),Common Lisp,Fortran,SQL (for the syntax, and for some vendor implementations, e.g.Microsoft SQL Server, the data itself)[NB 2]Pascal,Rexx andooRexx. There are also languages, such asHaskell,Prolog, andGo, in which the capitalisation of an identifier encodes information about itssemantics. Some other programming languages have varying case sensitivity; inPHP, 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.[4]
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, theGoogle Search engine is basically case-insensitive, with no option for case-sensitive search.[5] InOracle SQL, most operations and searches are case-sensitive by default,[6] while in most otherDBMSes, SQL searches are case-insensitive by default.[7]
Case-insensitive operations are sometimes said tofold case, from the idea of folding the character code table so that upper- and lowercase letters coincide.
In filesystems inUnix-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 usesHFS+ andAPFS in a case-insensitive (so that there cannot be a readme.txt and a Readme.txt in the same directory) butcase-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 andpower 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 MacInstallers assume case insensitivity and fail on case-sensitive file systems.
The olderMS-DOS filesystemsFAT12 andFAT16 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, withVFAT inWindows 95 the FAT file systems became case-preserving as an extension of supportinglong filenames.[8] Later Windows file systems such asNTFS 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.[9] This can cause problems for developers or software coming from Unix-like environments, similar to the problems with macOS case-insensitive file systems.