String (computer Science) - String Datatypes - String Length

String Length

Although formal strings can have an arbitrary (but finite) length, the length of strings in real languages is often constrained to an artificial maximum. In general, there are two types of string datatypes: fixed-length strings, which have a fixed maximum length and which use the same amount of memory whether this maximum is reached or not, and variable-length strings, whose length is not arbitrarily fixed and which use varying amounts of memory depending on their actual size. Most strings in modern programming languages are variable-length strings. Despite the name, even variable-length strings are limited in length, although, in general, the limit depends only on the amount of memory available. The string length can be stored as a separate integer (which puts a theoretical limit on the length) or implicitly through a termination character, usually a character value with all bits zero. See also "Null-terminated" below.

Read more about this topic:  String (computer Science), String Datatypes

Famous quotes containing the words string and/or length:

    The Indian remarked as before, “Must have hard wood to cook moose-meat,” as if that were a maxim, and proceeded to get it. My companion cooked some in California fashion, winding a long string of the meat round a stick and slowly turning it in his hand before the fire. It was very good. But the Indian, not approving of the mode, or because he was not allowed to cook it his own way, would not taste it.
    Henry David Thoreau (1817–1862)

    At length I heard a ragged noise and mirth
    Of thieves and murderers: there I him espied
    Who straight, Your suit is granted,said, and died.
    George Herbert (1593–1633)