| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 24 Substring Tests |
| 3 |
% Label: "ex:substrif" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage{datatool-base} |
| 9 |
\newcommand{\strA}{An apple} |
| 10 |
\newcommand{\strB}{n~ap} |
| 11 |
\begin{document} |
| 12 |
(First two arguments expanded) `\strB' |
| 13 |
\DTLifSubString{\strA}{\strB}{is substring}{isn't substring} |
| 14 |
of `\strA'. |
| 15 |
|
| 16 |
`app' |
| 17 |
\DTLifSubString{An apple}{app}{is substring}{isn't substring} |
| 18 |
of `An apple'. |
| 19 |
|
| 20 |
(Non-breakable space same as space) `n~a' |
| 21 |
\DTLifSubString{An apple}{n~a}{is substring}{isn't substring} |
| 22 |
of `An apple'. |
| 23 |
|
| 24 |
(Robust commands stripped) `app' |
| 25 |
\DTLifSubString{An \MakeUppercase{a}pple}{app}{is substring}{isn't substring} |
| 26 |
of `An \MakeUppercase{a}pple'. |
| 27 |
|
| 28 |
(Grouping stripped) `app' |
| 29 |
\DTLifSubString{An {ap}ple}{app}{is substring}{isn't substring} |
| 30 |
of `An {ap}ple'. |
| 31 |
|
| 32 |
(Case-sensitive) `app' |
| 33 |
\DTLifSubString{An Apple}{app}{is substring}{isn't substring} |
| 34 |
of `An Apple'. |
| 35 |
|
| 36 |
(Not case-sensitive) `app' \DTLifSubString*{An Apple}{app}{is substring}{isn't substring} |
| 37 |
of `An Apple'. |
| 38 |
|
| 39 |
(Leading space) ` app' |
| 40 |
\DTLifSubString{Anapple}{ app}{is substring}{isn't substring} |
| 41 |
of `Anapple'. |
| 42 |
\end{document} |