% This file is embedded in datatool-user.pdf version 3.4.5 2026-08-23
% Example 25 Prefix Tests
% Label: "ex:prefixif"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{datatool-base}
\newcommand{\strA}{An apple}
\newcommand{\strB}{n~ap}
\newcommand{\strC}{An~ap} 
\begin{document}
(First two arguments expanded) `\strB' 
\DTLifStartsWith{\strA}{\strB}{is prefix}{isn't prefix}
of `\strA'. 

(First two arguments expanded) `\strC' 
\DTLifStartsWith{\strA}{\strC}{is prefix}{isn't prefix}
of `\strA'. 

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

(Robust commands stripped) `app'
\DTLifStartsWith{\MakeUppercase{a}pple}{app}{is prefix}{isn't prefix}
of `\MakeUppercase{a}pple'. 

(Case-sensitive) `app'
\DTLifStartsWith{Apple}{app}{is prefix}{isn't prefix}
of `Apple'. 

(Ignore case) `app'
\DTLifStartsWith*{Apple}{app}{is prefix}{isn't prefix}
of `Apple'. 

(Trailing space) `an '
\DTLifStartsWith{an apple}{an }{is prefix}{isn't prefix}
of `an apple'. 

(Trailing space) `an '
\DTLifStartsWith{anapple}{an }{is prefix}{isn't prefix}
of `anapple'. 
\end{document}
