String

From Mario Fan Games Galaxy Wiki
 Merge.png It has been suggested that this article should be merged with Data Types.

See this article's talk page for more information.

A string is a sequence of characters, but not necessarily letters or numbers. In some languages, there isn't really a true string datatype; instead, it is an array in which each cell contains one character.

Strings are often used; everything from file paths to associative array keys use strings. A special string, the empty string (usually seen as ""), is similar to 0 in many languages; concatenating it does not change the other string, and it is usually used to define a string variable.

Depending on the language, a string may or may not be null-terminated. A null-terminated string cannot contain null characters (which are sometimes useful), however they are only limited in length by available memory. Non-null-terminated strings are limited to a length defined in an associated variable, but this is generally very large on modern systems.

Strings may be immutable, which means they can't be changed. This is generally the case with languages that treat strings as objects; any "changes" to the original string actually create a new string. Mutable strings are usually those based on arrays. Like arrays, they can be changed without needing to create a new string.

The common process of adding two or more strings together is concatenation, and the operator used for this varies; in some languages, it is the same one used for numeric addition. Another common operations on strings is tokenizing, or splitting the string into substrings based on certain characters in the string.