| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 25 Prefix Tests |
| 3 |
% Label: "ex:prefixif" |
| 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 |
\newcommand{\strC}{An~ap} |
| 12 |
\begin{document} |
| 13 |
(First two arguments expanded) `\strB' |
| 14 |
\DTLifStartsWith{\strA}{\strB}{is prefix}{isn't prefix} |
| 15 |
of `\strA'. |
| 16 |
|
| 17 |
(First two arguments expanded) `\strC' |
| 18 |
\DTLifStartsWith{\strA}{\strC}{is prefix}{isn't prefix} |
| 19 |
of `\strA'. |
| 20 |
|
| 21 |
(Non-breakable space same as space) `An~a' |
| 22 |
\DTLifStartsWith{An apple}{An~a}{is prefix}{isn't prefix} |
| 23 |
of `An apple'. |
| 24 |
|
| 25 |
(Robust commands stripped) `app' |
| 26 |
\DTLifStartsWith{\MakeUppercase{a}pple}{app}{is prefix}{isn't prefix} |
| 27 |
of `\MakeUppercase{a}pple'. |
| 28 |
|
| 29 |
(Case-sensitive) `app' |
| 30 |
\DTLifStartsWith{Apple}{app}{is prefix}{isn't prefix} |
| 31 |
of `Apple'. |
| 32 |
|
| 33 |
(Ignore case) `app' |
| 34 |
\DTLifStartsWith*{Apple}{app}{is prefix}{isn't prefix} |
| 35 |
of `Apple'. |
| 36 |
|
| 37 |
(Trailing space) `an ' |
| 38 |
\DTLifStartsWith{an apple}{an }{is prefix}{isn't prefix} |
| 39 |
of `an apple'. |
| 40 |
|
| 41 |
(Trailing space) `an ' |
| 42 |
\DTLifStartsWith{anapple}{an }{is prefix}{isn't prefix} |
| 43 |
of `anapple'. |
| 44 |
\end{document} |