Case folding

Case folding

Case folding is a term denoting the conversion of all characters in a string to lower or upper-case, typically to make case-insensitive comparisons.

Case Folding in some high-level languages

Most, if not all, BASIC dialects provide these basic functions:

UpperA$ = UCASE$("a") LowerA$ = LCASE$("A")

C and C++, as well as any C-like language that conforms to its standard library, provide these functions in the file ctype.h:

char upperA = toupper('a'); char lowerA = tolower('A');

Algorithms to fold case

Case folding is different with different character sets. In ASCII case can be folded in the following way, in C:

#define toupper(c) islower(c) ? (c) - 'a' + 'A' : (c) #define tolower(c) isupper(c) ? (c) - 'A' + 'a' : (c)

This only works because the alphanumeric letters are consecutive. This would not work, for instance, with EBCDIC.

Unicode case folding

Unicode defines case folding through the three case mapping properties of each character: uppercase, lowercase and titlecase. These properties relate all characters in scripts with differring cases to the other case variants of the character.


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Folding — Fold may refer to:*Above the fold, a graphic design concept originating in newspapers *Fold (from the Saxon falod ) meaning a staked off pasture area (e.g. Sheepfold, an enclosure for sheep) and used in place names such as the Fold Villages.… …   Wikipedia

  • Folding@home — Original author(s) Vijay Pande Developer(s) Stanford University / Pande lab Initial release 2000 10 01 …   Wikipedia

  • folding bag — case or handbag that can be folded together for easy storage or carrying …   English contemporary dictionary

  • Folding machine — A folding machine is a machine used for folding, usually of paper.A fold (in paper) can be made by a Buckle or a Knife.There are generally three types of folding machines. Buckle Folders, Knife Folders or a Combination of these two types. Buckle… …   Wikipedia

  • Case sensitivity — Text sometimes exhibits case sensitivity; that is, words can differ in meaning based on differing use of uppercase and lowercase letters. Words with capital letters don t always have the same meaning when written with lowercase letters.For… …   Wikipedia

  • case — Synonyms and related words: Bible truth, Smyth sewing, abessive, ablative, absolute fact, accepted fact, accusative, action, actual fact, adessive, admitted fact, afghan, alien, allative, ammunition box, anyhow, anyway, apoplectic, approximative …   Moby Thesaurus

  • Letter case — For the minimalist musical sub genre, see Lowercase (music). For New Testament minuscules, see Category:Greek New Testament minuscules. Williamsburg eighteenth century press letters In orthography and typography, letter case (or just case) is the …   Wikipedia

  • Napkin folding problem — The napkin folding problem in geometry explores whether folding a square or a rectangular napkin can increase its perimeter. The problem is known under several names, including the Margulis napkin problem, suggesting it is due to Grigory Margulis …   Wikipedia

  • Oxidative folding — Oxidative protein folding is a process that is responsible for the formation of disulfide bonds between cysteine residues in proteins. The driving force behind this process is a redox reaction, in which electrons are passed between several… …   Wikipedia

  • Constant folding — and constant propagation are related compiler optimizations used by many modern compilers. An advanced form of constant propagation known as sparse conditional constant propagation can more accurately propagate constants and simultaneously remove …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”