% This file is embedded in datatool-user.pdf version 3.4.4 2026-07-31
% Example 24 Substring Tests
% Label: "ex:substrif"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{datatool-base}
\newcommand{\strA}{An apple}
\newcommand{\strB}{n~ap} 
\begin{document}
(First two arguments expanded) `\strB' 
\DTLifSubString{\strA}{\strB}{is substring}{isn't substring}
of `\strA'. 

`app'
\DTLifSubString{An apple}{app}{is substring}{isn't substring}
of `An apple'. 

(Non-breakable space same as space) `n~a'
\DTLifSubString{An apple}{n~a}{is substring}{isn't substring}
of `An apple'. 

(Robust commands stripped) `app'
\DTLifSubString{An \MakeUppercase{a}pple}{app}{is substring}{isn't substring}
of `An \MakeUppercase{a}pple'. 

(Grouping stripped) `app'
\DTLifSubString{An {ap}ple}{app}{is substring}{isn't substring}
of `An {ap}ple'. 

(Case-sensitive) `app'
\DTLifSubString{An Apple}{app}{is substring}{isn't substring}
of `An Apple'. 

(Not case-sensitive) `app' \DTLifSubString*{An Apple}{app}{is substring}{isn't substring}
of `An Apple'. 

(Leading space) ` app'
\DTLifSubString{Anapple}{ app}{is substring}{isn't substring}
of `Anapple'. 
\end{document}
