String Function

Jump to navigation Jump to search

A String Function is a function whose function domain is a string set.




  • (Wikipedia, 2020b) ⇒ Retrieved:2020-2-23.
    • String functions are used in computer programming languages to manipulate a string or query information about a string (some do both).

      Most programming languages that have a string datatype will have some string functions although there may be other low-level ways within each language to handle strings directly. In object-oriented languages, string functions are often implemented as properties and methods of string objects. In functional and list-based languages a string is represented as a list (of character codes), therefore all list-manipulation procedures could be considered string functions. However such languages may implement a subset of explicit string-specific functions as well.

      For function that manipulate strings, modern object-oriented languages, like C# and Java have immutable strings and return a copy (in newly allocated dynamic memory), while others, like C manipulate the original string unless the programmer copies data to a new string. See for example Concatenation below.

      The most basic example of a string function is the length(string) function. This function returns the length of a string literal.

      :e.g. length("hello world") would return 11.

      Other languages may have string functions with similar or exactly the same syntax or parameters or outcomes. For example, in many languages the length function is usually represented as len(string). The below list of common functions aims to help limit this confusion.