From WikiChip
string manipulation

String manipulation (or string handling) is the process of changing, parsing, splicing, pasting, or analyzing strings. String manipulation typically comes as a mechanism or a library feature of in most programming languages.

Typically, most programming languages provide a string data type that holds a sequence of characters. Such types often expose a set of functions and various other low-level functionality for manipulating the contained characters.

Common operations[edit]

  • Concatenation is the process of joining two strings together into a single string. For example "race" concatenated with "car" results in "racecar".
  • Splitting is the process of breaking down a string into multiple strings according to a certain delimiter or rule (e.g. regex pattern). For example "A B C" could be split into three separate strings, ("A", "B", "C"), using the space character as a delimiter.
  • Substrings is the process of extracting a portion of the string from a bigger string. Such operations typically involve a starting offset and a length. For example, one possible substring of "apples" is "pp".
  • Case conversion is the process of converting a string into a specific case for example into all lowercase or titlecase.
  • Searching is the process of searching for a specific pattern in a string.

In various languages[edit]

Most programming languages provide a built-in mechanism or library functions for manipulating strings.