Case-insensitive: Difference between revisions

9,194 bytes added ,  3 October 2024
no edit summary
(Created page with "{{Short description|Defines whether uppercase and lowercase letters are treated as distinct}} thumb|159px|The [[lowercase "a" and uppercase "A" are the two case variants of the first letter in the English alphabet.]] In computers, '''case sensitivity''' defines whether uppercase and lowercase letters are treated as distinct ('''case-sensitive''') or equivalent ('''case-insensitive'''). For instance, when users i...")
Tags: Mobile edit Mobile web edit Advanced mobile edit
 
No edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
Line 3: Line 3:


In computers, '''case sensitivity''' defines whether [[letter case|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.
In computers, '''case sensitivity''' defines whether [[letter case|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:
* [[String-searching algorithm|Searching]]: Users expect information retrieval systems to be able to have correct case sensitivity depending on the nature of an operation. Users looking for the word "dog" in an online journal probably do not wish to differentiate between "dog" or "Dog", as this is a writing distinction; the word should be matched whether it appears at the beginning of a sentence or not. On the other hand, users looking for information about a brand name, trademark, human name, or city name may be interested in performing a case-sensitive operation to filter out irrelevant results. For example, somebody searching for the name "Jade" would not want to find references to the mineral called "jade". On the English Wikipedia for example a search for [[friendly fire]] returns the military article but [[Friendly Fire (disambiguation)|Friendly Fire]] (capitalized "Fire") returns the disambiguation page.<ref group=NB>The link "Friendly Fire" must go through the (disambiguation) qualifier in a Wikipedia article to avoid a [[WP:INTDAB]] error.</ref><ref>See [[WP:DIFFCAPS]]</ref>
* [[Username]]s: Authentication systems usually treat usernames as case-insensitive to make them easier to remember, reducing typing complexity, and eliminate the possibility of both mistakes and [[Impersonator|fraud]] when two usernames are identical in every aspect except the case of one of their letters. However, these systems are not case-blind. They [[case preservation|preserve the case of the characters in the name]] so that users may choose an aesthetically pleasing username combination.
* [[Password]]s: Authentication systems usually treat passwords as case-sensitive. This enables the users to increase the complexity of their passwords.
* [[Filename#Letter case preservation|File names]]: Traditionally, [[Unix-like]] operating systems treat file names case-sensitively while [[Microsoft Windows]] is case-insensitive but, for most file systems, [[case preservation|case-preserving]]. For more details, see below.
* [[Variable (programming)|Variable names]]: Some programming languages are case-sensitive for their variable names while others are not. For more details, see below.
* [[URL]]s: The ''path'', ''query'', ''fragment'', and ''authority'' sections of a URL may or may not be case-sensitive, depending on the receiving [[web server]]. The ''scheme'' and ''host'' parts, however, are strictly lowercase.
==In programming languages==
Some [[programming languages]] are case-sensitive for their identifiers ([[C (programming language)|C]], [[C++]], [[Java (programming language)|Java]], [[C Sharp (programming language)|C#]], [[Verilog]],<ref name="k&r1e">{{cite book | last1 = Kernighan | first1 = Brian W. | author-link = Brian Kernighan | last2 = Ritchie | first2 = Dennis M. | author-link2 = Dennis Ritchie | chapter = Chapter 2: Types, Operators and Expressions | page = [https://archive.org/details/cprogramminglang00kern/page/33 33] | title = [[The C Programming Language]] | edition = 1st | publisher = Prentice Hall | date = February 1978 | location = Englewood Cliffs, NJ | isbn = 0-13-110163-3 }}</ref> [[Ruby (programming language)|Ruby]],<ref>{{cite book | last = Matsumoto | first = Yukihiro | author-link = Yukihiro Matsumoto | chapter = Chapter 2: Language Basics | page = [https://archive.org/details/rubyinnutshellde00mats/page/9 9] | title = Ruby in a nutshell | edition = 1st | publisher = O'Reilly Media | date = January 2002 | isbn = 0-596-00214-9 | chapter-url = https://archive.org/details/rubyinnutshellde00mats/page/9 }}</ref> [[Python (programming language)|Python]] and [[Swift (programming language)|Swift]]). Others are case-insensitive (i.e., not case-sensitive), such as [[ABAP]], [[Ada (programming language)|Ada]], most [[BASIC]]s (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)<ref group='NB'>Although one can explicitly set a single database or column [[collation]] to be case-sensitive</ref> [[Pascal (programming language)|Pascal]], [[Rexx]] and [[Object REXX|ooRexx]].  There are also languages, such as [[Haskell (programming language)|Haskell]], [[Prolog]], and [[Go (programming language)|Go]], in which the capitalisation of an identifier encodes information about its [[Semantics (computer science)|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 (programming language)|Nim]] is case-insensitive and ignores underscores, as long as the first characters match.<ref>{{Cite web|url=https://nim-lang.github.io/Nim/manual.html#lexical-analysis-identifier-equality|title=Nim Manual: Identifier Equality|website=nim-lang.github.io|access-date=2019-04-27}}</ref>
==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.<ref>{{cite web|url=https://code.google.com/p/case-sensitive-search/ |title=case-sensitive-search - case sensitive google search - Google Project Hosting |work=code.google.com |access-date=2013-05-20}}</ref>  In [[Oracle database|Oracle]] SQL most operations and searches are case-sensitive by default,<ref>{{cite book|url=http://docs.oracle.com/cd/E12151_01/doc.150/e12152.pdf|title=Oracle SQL Developer User's Guide, Release 1.5|section=2.10 Making Queries Case Insensitive|date=August 2013|publisher=[[Oracle Corporation]]}}</ref> while in most other [[Database management system|DBMS]]'s SQL searches are case-insensitive by default.<ref>{{cite web|url=http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html |work= MySQL 5.0 Reference Manual |title=C.5.5.1 Case Sensitivity in String Searches |publisher=MySQL  |access-date=2013-05-20}}</ref>
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 Plus|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 preservation|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 [[Installation (computer programs)#Installer|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]].<ref>{{cite web|url=https://technet.microsoft.com/en-us/library/cc739978(v=ws.10).aspx |title=Case Sensitivity in Subsystem for UNIX-based Applications |work=Microsoft Learn |date=2005-08-22 |access-date=2013-05-20}}</ref> 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.<ref>{{cite web|url=http://support.microsoft.com/kb/100625 |title=Filenames are Case Sensitive on NTFS Volumes |work=Microsoft Support |date=2006-11-01 |url-status=dead |archive-url=https://web.archive.org/web/20130723020137/http://support.microsoft.com/kb/100625 |archive-date=Jul 23, 2013 |access-date=2013-05-20}}</ref> This can cause problems for developers or software coming from Unix-like environments, similar to the problems with macOS case-insensitive file systems.
==Notes==
{{reflist|group='NB'}}
==References==
{{reflist}}
[[Category:Capitalization]]