\documentclass{minimal}
\usepackage{substr}
\def\str{hellohello}
\def\longstr{hellohellohellohello}
\def\medstr{hellohellohello}
\def\substr{ell}
\def\subSTR{ELL}

\newcounter{appearances}
\begin{document}

\bigskip{\bfseries IfSubStringInString}

\IfSubStringInString{\substr}{\str}{``\subSTR'' is in ``\str''}{Error}

\IfSubStringInString{\subSTR}{\str}{Error}{No ``\subSTR'' in ``\str''}

\IfSubStringInString{day after }{day after day}{JA}{NEIN}
\IfSubStringInString{AMSTERD}{AMSTERDAM}{JA}{NEIN}
\IfSubStringInString{bon}{bonbon}{JA}{NEIN}
\IfSubStringInString{bono}{bonobo}{JA}{NEIN}
\IfSubStringInString{ionizat}{ionization}{JA}{NEIN}

\IfSubStringInString{day after day}{day after }{JA}{NEIN}
\IfSubStringInString{AMSTERDAM}{AMSTERD}{JA}{NEIN}
\IfSubStringInString{bonbon}{bon}{JA}{NEIN}
\IfSubStringInString{bonobo}{bono}{JA}{NEIN}
\IfSubStringInString{ionization}{ionizat}{JA}{NEIN}



\bigskip{\bfseries BeforeSubString and BehindSubString}

Text befor ``\substr'' in ``\str'': 
\BeforeSubString{\substr}{\str}

Text after ``\substr'' in ``\str'': 
\BehindSubString{\substr}{\str}

\BeforeSubString{\substr}{\str}%
\emph{\bfseries\substr}%
\BehindSubString{\substr}{\str}


\bigskip{\bfseries CountSubStrings}

Count of ``\substr'' in ``\str'': 
\CountSubStrings{\substr}{\str}

Count of ``\substr'' in ``\medstr'': 
\CountSubStrings{\substr}{\medstr}

Count of ``\substr'' in ``\longstr'': 
\CountSubStrings{\substr}{\longstr}


\bigskip{\bfseries SubStringsToCounter}

\SubStringsToCounter{appearances}{\substr}{\str}%
Count of ``\substr'' in \str'' (counter): 
\theappearances

\end{document}
