summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/substr/testsubstr.tex
blob: 1429b7515a0e14b540d4609505884c297e6bdf4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
\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}