Substring: Difference between revisions

Content deleted Content added
Added links, added overarching topic at beginning, changed formatting
Tags: Mobile edit Mobile app edit iOS app edit
top: prefix (computer science) would be the most appropriate link, but it redirects here; likewise for suffix (computer science)
Line 4:
In [[Formal language|formal language theory]] and [[computer science]], a '''substring''' is a contiguous sequence of [[Character (computing)|character]]s within a [[String (computer science)|string]]. For instance, "''the best of''" is a substring of "''It was the best of times''". This is not to be confused with [[subsequence]], which is a [[generalization]] of substring. For example, "''Itwastimes''" is a subsequence of "''It was the best of times''", but not a substring.
 
[[Prefix]]es'''Prefixes''' and [[suffix]]es'''suffixes''' are special cases of substrings. A prefix of a string <math>S</math> is a substring of <math>S</math> that occurs at the beginning of <math>S</math>; likewise, a suffix of a string <math>S</math> is a substring that occurs at the end of <math>S</math>.
 
The list of all substrings of the string "''apple''" would be "''apple''", "''appl''", "''pple''", "''app''", "''ppl''", "''ple''", "''ap''", "''pp''", "''pl''", "''le''", "''a''", "''p''", "''l''", "''e''", "".