

In implementations with string terminating character (null-terminated strings or plain text lines), the empty string is indicated by the immediate use of this terminating character. The empty string is usually represented similarly to other strings. Some languages treat empty strings, null references, the integer 0, the floating point number 0, the Boolean value false, the ASCII character NUL, and other similar values similarly. In most programming languages, the empty string is distinct from a null reference (or null pointer) because a null reference points to no string at all, not even the empty stringThe empty string is a valid string, and most string operations should work on it. However, a string comparison function would indicate that all of these empty strings are equal to each other.Įven a string of length zero can require memory to store it, depending on the format being used. In this way, there could be multiple empty strings in memory, in contrast with the formal theory definition, for which there is only one possible empty string. Strings are typically stored at distinct memory addresses (locations)As a result, the same string (for example, the empty string) may be stored in multiple locations in memory. In most programming languages, strings are a data type. In context-free 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". a set of strings) that contains no strings, not even the empty string. The empty string should not be confused with the empty language ∅, which is a formal language (i.e. A string is formally defined as a finite, ordered sequence of characters such as letters, digits, or spaces the empty string is the special case where the sequence has length zero and thus contains no symbols.Because two strings are only different if they have different lengths or a different sequence of symbols, there is only one empty string in formal treatments, the empty string is denoted with or, sometimes or.
