Does Sony Repair Grey Market Cameras

By | 16/10/2022

Unique cord of length zero

In formal language theory, the
empty string, or
empty word, is the unique cord of length zero.

Formal theory


Formally, a string is a finite, ordered sequence of characters such equally messages, digits or spaces. The empty string is the special case where the sequence has length nada, so there are no symbols in the string. In that location is simply i empty string, because two strings are merely different if they have different lengths or a dissimilar sequence of symbols. In formal treatments,[ane]
the empty cord is denoted with
or sometimes

The empty string should not be dislocated with the empty language ∅, which is a formal language (i.e. a ready of strings) that contains no strings, not even the empty string.

The empty string has several properties:

  • |ε| = 0. Its string length is nil.
  • ε ⋅ s = due south ⋅ ε = s. The empty string is the identity chemical element of the concatenation operation. The set of all strings forms a free monoid with respect to ⋅ and ε.
  • εR
    = ε. Reversal of the empty string produces the empty string.
  • The empty string precedes whatsoever other string under lexicographical order, because information technology is the shortest of all strings.[2]

In context-complimentary grammars, a production rule that allows a symbol to produce the empty string is known as an ε-production, and the symbol is said to be “nullable”.

Use in programming languages


In nearly programming languages, strings are a data type. Strings are typically stored at singled-out memory addresses (locations). Thus, the aforementioned cord (for example, the empty string) may be stored in two or more than places in memory.

In this way, there could exist multiple empty strings in retentivity, in contrast with the formal theory definition, for which in that location is only 1 possible empty string. However, a string comparison office would betoken that all of these empty strings are equal to each other.

Even a cord of length zippo can crave memory to store it, depending on the format being used. In most programming languages, the empty string is distinct from a naught reference (or zero pointer) because a cypher reference points to no string at all, not fifty-fifty the empty cord. The empty string is a legitimate string, upon which most cord operations should work. Some languages treat some or all of the following in like ways: empty strings, null references, the integer 0, the floating signal number 0, the Boolean value false, the ASCII graphic symbol NUL, or other such values.

The empty cord is usually represented similarly to other strings. In implementations with string terminating graphic symbol (zippo-terminated strings or apparently text lines), the empty cord is indicated by the immediate use of this terminating graphic symbol.

λ representation Programming languages
"" C, C#, C++, Go, Haskell, Java, JavaScript, Julia, Lua, M, Objective-C (as a C string), OCaml, Perl, PHP, Python, Cherry, Scala, Standard ML, Swift, Tcl, Visual Bones .Net
'' APL, Delphi, JavaScript, Lua, MATLAB, Pascal, Perl, PHP, Python, R, Blood-red, Smalltalk, SQL
character(0) R[iii]
{'\0'} C, C++, Objective-C (as a C string)
std::cord() C++
""s C++ (since the 2014 standard)
@"" Objective-C (as a constant
[NSString string] Objective-C (as a new
q(), qq() Perl
str() Python

string.Empty C#, Visual Bones .Internet
String.make 0 '-' OCaml
{} Tcl
[[]] Lua

Examples of empty strings


The empty string is a syntactically valid representation of zero in positional notation (in any base), which does non contain leading zeros. Since the empty string does non have a standard visual representation exterior of formal language theory, the number goose egg is traditionally represented past a single decimal digit

Nada-filled memory area, interpreted as a aught-terminated string, is an empty string.

Empty lines of text show the empty string. This can occur from two consecutive EOLs, as often occur in text files, and this is sometimes used in text processing to separate paragraphs, e.g. in MediaWiki.

See as well


  • Empty prepare
  • Zero-terminated string
  • Concatenation theory



  1. ^

    Corcoran, John; Frank, William; Maloney, Michael (1974). “String theory”.
    Periodical of Symbolic Logic.
    (4): 625–637. doi:10.2307/2272846. JSTOR 2272846.

  2. ^

    CSE1002 Lecture Notes – Lexicographic

  3. ^

    At that place are two ways to create “empty strings” in R; the other is listed here every bit
    creates empty character vectors, which will output 0 when counted.