% This file is embedded in datatool-user.pdf version 3.4.1 2025-04-25
% Example 47 String Substitution and Splitting
% Label: "ex:subsplitstr"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{datatool-base} 
\begin{document}
\newcommand{\test}{The goose looked at a book and said \emph{ooh}.}
{% local scope
 Original: \test
\DTLsubstitute{\test}{oo}{ee}
Substituted first: \test } 

{% local scope
 Original: \test
 \DTLsubstituteall{\test}{oo}{ee}
 Substituted all: \test } 

Split on `looked' (no expansion)
\DTLsplitstring{\test}{looked}{\before}{\after} 

Before: `\before'. After: `\after' 

Split on `looked' (with expansion)
\DTLxsplitstring{\test}{looked}{\before}{\after} 

Before: `\before'. After: `\after' 
\end{document}
