String Function
A String Function is a function whose function domain is a string set.
- AKA: String-Input Function, String Manipulation Function.
- Example(s):
- Counter-Example(s):
- See: String-Output Function, String Relation, String Operation, Set Function, String Manipulation Algorithm, String Processing Algorithm.
References
2020a
- (Wikipedia, 2020a) ⇒ https://en.wikipedia.org/wiki/String_(computer_science)#String_processing_algorithms Retrieved:2020-2-23.
- There are many algorithms for processing strings, each with various trade-offs. Competing algorithms can be analyzed with respect to run time, storage requirements, and so forth.
Some categories of algorithms include:
- String searching algorithms for finding a given substring or pattern
- String manipulation algorithms.
- Sorting algorithms.
- Regular expression algorithms
- Parsing a string
- Sequence mining.
- Advanced string algorithms often employ complex mechanisms and data structures, among them suffix trees and finite state machines.
The name stringology was coined in 1984 by computer scientist Zvi Galil for the issue of algorithms and data structures used for string processing.
- There are many algorithms for processing strings, each with various trade-offs. Competing algorithms can be analyzed with respect to run time, storage requirements, and so forth.
2020b
- (Wikipedia, 2020b) ⇒ https://en.wikipedia.org/wiki/Comparison_of_programming_languages_(string_functions) 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.
- String functions are used in computer programming languages to manipulate a string or query information about a string (some do both).
2020c
- (PostgreSQL GDG, 2020) ⇒ PostgreSQL Global Development Group (1996-2020). "9.4. String Functions and Operators".. In: PostgreSQL 9.4.26 Documentation. Retrieved:2020-2-23.
- QUOTE: This section describes functions and operators for examining and manipulating string values. Strings in this context include values of the types character, character varying, and text. Unless otherwise noted, all of the functions listed below work on all of these types, but be wary of potential effects of automatic space-padding when using the character type. Some functions also exist natively for the bit-string types.
SQL defines some string functions that use key words, rather than commas, to separate arguments. Details are in Table 9-6. PostgreSQL also provides versions of these functions that use the regular function invocation syntax (see Table 9-7).
- QUOTE: This section describes functions and operators for examining and manipulating string values. Strings in this context include values of the types character, character varying, and text. Unless otherwise noted, all of the functions listed below work on all of these types, but be wary of potential effects of automatic space-padding when using the character type. Some functions also exist natively for the bit-string types.
2020d
- (GNU, 2020) ⇒ https://www.gnu.org/software/gawk/manual/html_node/String-Functions.html Retrieved:2020-2-23.
- QUOTE:
gawk
understands locales (see section "Where You Are Makes a Difference") and does all string processing in terms of characters, not bytes. This distinction is particularly important to understand for locales where one character may be represented by multiple bytes. Thus, for example,length()
returns the number of characters in a string, and not the number of bytes used to represent those characters. Similarly,index()
works with character indices, and not byte indices.
- QUOTE:
2020e
- (Rossum, 2020) ⇒ Guido van Rossum (2020). "String Methods". In: "Python Reference Library" (2008-2020). Retrieved:2020-2-23.
2020f
- (GeeksforGeeks, 2020) ⇒ https://www.geeksforgeeks.org/strings-in-c-2/ Retrieved:2020-2-23.
- QUOTE: Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special character
‘\0’
.Declaration of strings: Declaring a string is as simple as declaring a one dimensional array. Below is the basic syntax for declaring a string.
char str_name[size];
In the above syntax
str_name
is any name given to the string variable and size is used define the length of the string, i.e the number of characters strings will store. Please keep in mind that there is an extra terminating character which is the Null character (‘\0’
) used to indicate termination of string which differs strings from normal character arrays.
- QUOTE: Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special character