String (computer science)

related topics
{math, number, function}
{system, computer, user}
{language, word, form}
{style, bgcolor, rowspan}
{@card@, make, design}

In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet.

In computer programming, a string is, essentially, a sequence of characters. A string is generally understood as a data type storing a sequence of data values, usually bytes, in which elements usually stand for characters according to a character encoding, which differentiates it from the more general array data type. In this context, the terms binary string and byte string are used to suggest strings in which the stored data does not (necessarily) represent text.

A variable declared to have a string data type usually causes storage to be allocated in memory that is capable of holding some predetermined number of symbols. When a string appears literally in source code, it is known as a string literal and has a representation that denotes it as such.


Formal theory

Let Σ be an alphabet, a non-empty finite set. Elements of Σ are called symbols or characters. A string (or word) over Σ is any finite sequence of characters from Σ. For example, if Σ = {0, 1}, then 0101 is a string over Σ.

Full article ▸

related documents
Division (mathematics)
Locally compact space
Trace (linear algebra)
Cauchy–Schwarz inequality
Chinese remainder theorem
Miranda (programming language)
Elementary algebra
Ideal (ring theory)
Abel–Ruffini theorem
Transposition cipher
Logical connective
Rice's theorem
Gödel's completeness theorem
Natural logarithm
Brute-force search
Power series
Merge sort
Holomorphic function
J (programming language)
Field extension
Normed vector space
Preadditive category
Convergence of random variables
Objective Caml
Splay tree
Axiom schema of specification
Ordinary differential equation