Home / Definitions / Programming String

Programming String

Webopedia Staff
Last Updated May 24, 2021 8:03 am

A programming string is a combination of characters joined together or multiple strings joined in a longer string. It can either remain unchanged or can be changed, depending on the type of string and the programming language. Different languages have mutable (changeable) and immutable (unchangeable) strings. Strings can also be fixed or variable in length. In Python, for example, each character is its own immutable string, and those strings are joined together to form longer strings.

String literals

A string literal is a character or character string that holds the same value and remains unchanged. Instead of using variables to perform a specific function within the string, a string literal remains the same in both code and published content. To denote a string literal within programming, most languages use delimiters, which bracket or set apart the string (often using parentheses, quotation marks, or brackets).

String concatenation

Concatenation joins characters or strings together, often using a symbol called an operator (commonly + ). Concatenation can create compound character strings by joining two strings. Concatenation may not always require an operator for two string literals (in Python, for example). Some programming languages don’t easily concatenate strings and require more complicated functions to join them.