| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 20 String Equality Tests |
| 3 |
% Label: "ex:streq" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage{datatool-base} |
| 9 |
\newcommand{\strA}{zebra} |
| 10 |
\newcommand{\strB}{Zebra} |
| 11 |
\begin{document} |
| 12 |
`\strA' is \DTLifstringeq{\strA}{\strB}{the same}{not the same} as `\strB' (case). |
| 13 |
|
| 14 |
`\strA' is \DTLifstringeq*{\strA}{\strB}{the same}{not the same} as `\strB' (no case). |
| 15 |
|
| 16 |
`\strA' is \DTLifstringeq{\strA}{zebra}{the same}{not the same} as `zebra' (case). |
| 17 |
|
| 18 |
`\emph{ant}' is \DTLifstringeq{\emph{ant}}{ant}{the same}{not the same} as `ant'. |
| 19 |
|
| 20 |
\DTLsetup{compare={skip-cs}} `\emph{ant}' is \DTLifstringeq{\emph{ant}}{ant}{the same}{not the same} as `ant' (skip cs). |
| 21 |
|
| 22 |
`ant zebra' is \DTLifstringeq{ant zebra}{ant \strA}{the same}{not the same} as `ant \strA' (no expansion). |
| 23 |
|
| 24 |
\DTLsetup{compare={expand-cs}} `ant zebra' is \DTLifstringeq{ant zebra}{ant \strA}{the same}{not the same} as `ant \strA' (expansion). |
| 25 |
\end{document} |