Debian Codegraph @

texmf-dist/doc/latex/substr/testsubstr.tex

raw
1 \documentclass{minimal}
2 \usepackage{substr}
3 \def\str{hellohello}
4 \def\longstr{hellohellohellohello}
5 \def\medstr{hellohellohello}
6 \def\substr{ell}
7 \def\subSTR{ELL}
8
9 \newcounter{appearances}
10 \begin{document}
11
12 \bigskip{\bfseries IfSubStringInString}
13
14 \IfSubStringInString{\substr}{\str}{``\subSTR'' is in ``\str''}{Error}
15
16 \IfSubStringInString{\subSTR}{\str}{Error}{No ``\subSTR'' in ``\str''}
17
18 \IfSubStringInString{day after }{day after day}{JA}{NEIN}
19 \IfSubStringInString{AMSTERD}{AMSTERDAM}{JA}{NEIN}
20 \IfSubStringInString{bon}{bonbon}{JA}{NEIN}
21 \IfSubStringInString{bono}{bonobo}{JA}{NEIN}
22 \IfSubStringInString{ionizat}{ionization}{JA}{NEIN}
23
24 \IfSubStringInString{day after day}{day after }{JA}{NEIN}
25 \IfSubStringInString{AMSTERDAM}{AMSTERD}{JA}{NEIN}
26 \IfSubStringInString{bonbon}{bon}{JA}{NEIN}
27 \IfSubStringInString{bonobo}{bono}{JA}{NEIN}
28 \IfSubStringInString{ionization}{ionizat}{JA}{NEIN}
29
30
31
32 \bigskip{\bfseries BeforeSubString and BehindSubString}
33
34 Text befor ``\substr'' in ``\str'':
35 \BeforeSubString{\substr}{\str}
36
37 Text after ``\substr'' in ``\str'':
38 \BehindSubString{\substr}{\str}
39
40 \BeforeSubString{\substr}{\str}%
41 \emph{\bfseries\substr}%
42 \BehindSubString{\substr}{\str}
43
44
45 \bigskip{\bfseries CountSubStrings}
46
47 Count of ``\substr'' in ``\str'':
48 \CountSubStrings{\substr}{\str}
49
50 Count of ``\substr'' in ``\medstr'':
51 \CountSubStrings{\substr}{\medstr}
52
53 Count of ``\substr'' in ``\longstr'':
54 \CountSubStrings{\substr}{\longstr}
55
56
57 \bigskip{\bfseries SubStringsToCounter}
58
59 \SubStringsToCounter{appearances}{\substr}{\str}%
60 Count of ``\substr'' in \str'' (counter):
61 \theappearances
62
63 \end{document}