Substring - Prefix

Prefix

A prefix of a string is a string, where . A proper prefix of a string is not equal to the string itself ; some sources in addition restrict a proper prefix to be non-empty . A prefix can be seen as a special case of a substring.

Example: The string ban is equal to a prefix (and substring and subsequence) of the string banana:

banana ||| ban

The square subset symbol is sometimes used to indicate a prefix, so that denotes that is a prefix of . This defines a binary relation on strings, called the prefix relation.

In formal language theory, the term prefix of a string is also commonly understood to be the set of all prefixes of a string, with respect to that language. See the article on string functions for more details.

Read more about this topic:  Substring