Definition:Substring

Definition
Let $\mathcal L$ be a formal language with alphabet $\mathcal A$.

Let $S$ be a string in $\mathcal A$.

Let $T$ be a string in $\mathcal A$ such that:
 * $S = S_1 T S_2$

where:
 * $S_1$ and $S_2$ are strings in $\mathcal A$ (possibly null);
 * $S_1 T S_2$ is the concatenation of $S_1$, $T$ and $S_2$.

Then $T$ is called a substring of $S$.

It follows from this definition that $S$ is a substring of itself (by considering $S_1$ and $S_2$ as both null).

Also see

 * The initial part of a string $S$ is a substring of $S$.