Substring: Difference between revisions

Content deleted Content added
Border: Fixed typo.
Tags: Reverted Mobile edit Mobile web edit Advanced mobile edit
Substring: Hyphenated per MOS:HYPHEN
Tags: Reverted Mobile edit Mobile web edit Advanced mobile edit
Line 25:
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). {{citation needed|date=November 2020}}