blob: 2b9054ae045153991eb070d616fbd063f697a546 (
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
|
\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''}
\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}
|