Substring: Difference between revisions

Content deleted Content added
Substring: Remove false statement. For the string "banana", "nan" is a substring but it is neither a prefix nor a suffix.
Undid revision 964514904 by 172.113.246.243 (talk), gave justification in added example text
Line 22:
The first occurrence is obtained with <math>p=</math><code>b</code> and <math>s=</math><code>na</code>, while the second occurrence is obtained with <math>p=</math><code>ban</code> and <math>s</math> being the empty string.
 
A substring of a string is a [[#Prefix|prefix]] of a [[#Suffix|suffix]] of the string, and equivalently a suffix of a prefix; for example, <code>nan</code> is a prefix of <code>nana</code>, which is in turn a suffix of <code>banana</code>. If <math>u</math> is a substring of <math>t</math>, it is also a [[subsequence]], which is a more general concept. The occurrences of a given pattern in a given string can be found with a [[string searching algorithm]]. Finding the longest string which is equal to a substring of two or more strings is known as the [[longest common substring problem]].
In the mathematical literature, substrings are also called '''subwords''' (in America) or '''factors''' (in Europe).