\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[dvips,margin=1.5cm,noheadfoot]{geometry}
\pagestyle{empty}
\usepackage{verbatim}
\usepackage{listings}
\usepackage{xstring}
\usepackage{etex}

\makeatletter

\newcommand*\ExNorm{\@ifstar{\def\frontiere{|}\@Ex}{\def\frontiere{}\@Ex}}

\newcommand*\@Ex{%
	\relax%
	\ifmmode\hbox\else\leavevmode\null\fi%
	\bgroup%
		\verb@eol@error%
		\let\do\@makeother\dospecials%
		\verbatim@font\@noligs%
		\@@Ex%
	}
\newcommand*\@@Ex[1]{%
	\@vobeyspaces\frenchspacing\
	\catcode`#1\active%
	\lccode`\~`#1%
	\gdef\verb@balance@group{%
		\verb@egroup\@latex@error{\noexpand\verb commande illégale !!}%
		\@ehc%
		}%
	\aftergroup\verb@balance@group%
		\lowercase{%
			\let ~\verb@egroup%
			\everyeof{\noexpand}%
			\endlinechar=\m@ne%
			\def\@tempa##1~{%
				\hbox to \Partage\linewidth{\hfil##1~}\quad\scantokens{\frontiere##1\frontiere}\commentaire\gdef\commentaire{}%
				\par}%
			}%
	\@tempa%
}%
\makeatother

\newcommand\chapitre[2]{\medskip{\large\textbf{#1} \texttt{\textbackslash#2}}\smallskip}

\begin{document}
\setlength{\parindent}{0pt}

\begin{center}\Large{Ceci est le fichier de test de xstring}.\end{center}

\gdef\Partage{0.7}
\gdef\commentaire{}

Toutes les situations ne sont pas envisagées, mais au moins un grand nombre ! Les macros sont examinées dans l'ordre logique du code.

Lorsque le résultat contient des espaces ou peut conduire à des doutes, il sera entouré de «|», étant entendu que «||» est une chaîne vide.\bigskip

\chapitre{Le test}{IfSubStr}
\setverbdelim{|}

\ExNorm|\IfSubStr{abcdef}{cd}{vrai}{faux}|
\ExNorm|\IfSubStr{a b c d }{b c}{vrai}{faux}|
\ExNorm|\IfSubStr{a b c d }{bc}{vrai}{faux}|
\ExNorm|\IfSubStr{abcdef}{}{vrai}{faux}|
\ExNorm|\IfSubStr{a}{a}{vrai}{faux}|
\ExNorm|\IfSubStr{aaaa}{aa}{vrai}{faux}|
\ExNorm|\IfSubStr{a}{aa}{vrai}{faux}|
\ExNorm|\IfSubStr{éàèï}{à}{vrai}{faux}|
\ExNorm|\IfSubStr{éàèï}{ù}{vrai}{faux}|
\ExNorm|\IfSubStr{ÉÀÇ}{Ç}{vrai}{faux}|
\ExNorm|\IfSubStr{a}{}{vrai}{faux}|
\ExNorm|\IfSubStr{}{a}{vrai}{faux}|
\ExNorm|\IfSubStr{}{}{vrai}{faux}|
\ExNorm|\IfSubStr[2]{abaca}{a}{vrai}{faux}|
\ExNorm|\IfSubStr[3]{abaca}{a}{vrai}{faux}|
\ExNorm|\IfSubStr[4]{abaca}{a}{vrai}{faux}|
\ExNorm|\IfSubStr[-2]{abaca}{a}{vrai}{faux}|

\chapitre{Le test}{IfBeginWith}

\ExNorm|\IfBeginWith{abcdef}{adc}{vrai}{faux}|
\ExNorm|\IfBeginWith{abcdef}{abcd}{vrai}{faux}|
\ExNorm|\IfBeginWith{ a b c }{ a}{vrai}{faux}|
\ExNorm|\IfBeginWith{a b c d}{ab}{vrai}{faux}|
\ExNorm|\IfBeginWith{a}{a}{vrai}{faux}|
\ExNorm|\IfBeginWith{a}{aa}{vrai}{faux}|
\ExNorm|\IfBeginWith{éàèï}{è}{vrai}{faux}|
\ExNorm|\IfBeginWith{éàèï}{éà}{vrai}{faux}|
\ExNorm|\IfBeginWith{ÉÀÇ}{É}{vrai}{faux}|
\ExNorm|\IfBeginWith{a}{}{vrai}{faux}|
\ExNorm|\IfBeginWith{}{a}{vrai}{faux}|
\ExNorm|\IfBeginWith{}{}{vrai}{faux}|

\chapitre{Le test}{IfEndWith}

\ExNorm|\IfEndWith{abcdef}{ab}{vrai}{faux}|
\ExNorm|\IfEndWith{abcdef}{f}{vrai}{faux}|
\ExNorm|\IfEndWith{ a b c }{c}{vrai}{faux}|
\ExNorm|\IfEndWith{ a b c }{ }{vrai}{faux}|
\ExNorm|\IfEndWith{a}{a}{vrai}{faux}|
\ExNorm|\IfEndWith{a}{aa}{vrai}{faux}|
\ExNorm|\IfEndWith{éàèï}{è}{vrai}{faux}|
\ExNorm|\IfEndWith{éàèï}{ï}{vrai}{faux}|
\ExNorm|\IfEndWith{ÉÀÇ}{Ç}{vrai}{faux}|
\ExNorm|\IfEndWith{a}{}{vrai}{faux}|
\ExNorm|\IfEndWith{}{a}{vrai}{faux}|
\ExNorm|\IfEndWith{}{}{vrai}{faux}|

\chapitre{Le test}{IfSubStrBefore}

\ExNorm|\IfSubStrBefore{abcdef}{b}{e}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{abcdef}{e}{c}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{ a b c }{ }{b}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{ a b c }{ b}{c }{vrai}{faux}|
\ExNorm|\IfSubStrBefore{abcdef}{z}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{abcdef}{y}{z}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{abcdef}{a}{z}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{aaa}{a}{aa}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{abcdef}{a}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{éàèï}{à}{ï}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{éàèï}{é}{à}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{ÉÀÇ}{Ç}{É}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{a}{a}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{}{a}{b}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{a}{}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{}{a}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBefore{}{}{}{vrai}{faux}|
\ExNorm|\IfSubStrBefore[1,1]{abacada}{d}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBefore[1,2]{abacada}{d}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBefore[1,3]{abacada}{d}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBefore[1,4]{abacada}{d}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBefore[2,1]{maman papa}{a}{p}{vrai}{faux}|
\ExNorm|\IfSubStrBefore[2,2]{maman papa}{a}{p}{vrai}{faux}|
\ExNorm|\IfSubStrBefore[4,2]{maman papa}{a}{p}{vrai}{faux}|

\chapitre{Le test}{IfStrBehind}

\ExNorm|\IfSubStrBehind{abcdef}{b}{e}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{abcdef}{e}{c}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{ a b c }{ }{b}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{ a b c }{ c}{ a}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{abcdef}{z}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{abcdef}{y}{z}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{abcdef}{a}{z}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{aaa}{a}{aa}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{abcdef}{a}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{éàèï}{ï}{à}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{éàèï}{à}{é}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{ÉÀÇ}{À}{Ç}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{a}{a}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{}{a}{b}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{a}{}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{}{a}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBehind{}{}{}{vrai}{faux}|
\ExNorm|\IfSubStrBehind[1,1]{abacada}{c}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBehind[1,2]{abacada}{c}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBehind[1,3]{abacada}{c}{a}{vrai}{faux}|
\ExNorm|\IfSubStrBehind[2,1]{maman papa}{a}{p}{vrai}{faux}|
\ExNorm|\IfSubStrBehind[3,1]{maman papa}{a}{p}{vrai}{faux}|
\ExNorm|\IfSubStrBehind[3,2]{maman papa}{a}{p}{vrai}{faux}|
\ExNorm|\IfSubStrBehind[4,2]{maman papa}{a}{p}{vrai}{faux}|

\chapitre{La macro}{StrBefore}

\ExNorm|\StrBefore{abcedef}{e}|
\ExNorm*|\StrBefore{abcdef}{a}|
\ExNorm*|\StrBefore{abcdef}{z}|
\ExNorm*|\StrBefore{a b c d}{c}|
\ExNorm*|\StrBefore{a b c d}{ }|
\ExNorm*|\StrBefore[2]{a b c d}{ }|
\ExNorm*|\StrBefore[3]{a b c d}{ }|
\ExNorm*|\StrBefore[9]{a b c d}{ }|
\ExNorm*|\StrBefore[-7]{a b c d}{ }|
\ExNorm*|\StrBefore{abcdef}{Z}|
\ExNorm|\StrBefore{éàèï}{è}|
\ExNorm|\StrBefore[2]{étété}{é}|
\ExNorm|\StrBefore{ÉÀÇ}{À}|
\ExNorm*|\StrBefore[1]{aaaaaa}{aa}|
\ExNorm|\StrBefore[2]{aaaaaa}{aa}|
\ExNorm|\StrBefore[3]{aaaaaa}{aa}|
\ExNorm*|\StrBefore[4]{aaaaaa}{aa}|
\ExNorm*|\StrBefore{a}{}|
\ExNorm*|\StrBefore{}{a}|
\ExNorm*|\StrBefore{}{}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrBefore{abcedef}{e}[\aa]\aa|
\ExNorm*|\StrBefore{abcdef}{a}[\aa]\aa|
\ExNorm*|\StrBefore{abcdef}{z}[\aa]\aa|
\ExNorm*|\StrBefore{a b c d}{c}[\aa]\aa|
\ExNorm*|\StrBefore{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBefore[2]{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBefore[3]{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBefore[9]{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBefore[-7]{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBefore{abcdef}{Z}[\aa]\aa|
\ExNorm|\StrBefore{éàèï}{è}[\aa]\aa|
\ExNorm|\StrBefore[2]{étété}{é}[\aa]\aa|
\ExNorm|\StrBefore{ÉÀÇ}{À}[\aa]\aa|
\ExNorm*|\StrBefore[1]{aaaaaa}{aa}[\aa]\aa|
\ExNorm|\StrBefore[2]{aaaaaa}{aa}[\aa]\aa|
\ExNorm|\StrBefore[3]{aaaaaa}{aa}[\aa]\aa|
\ExNorm*|\StrBefore[4]{aaaaaa}{aa}[\aa]\aa|
\ExNorm*|\StrBefore{a}{}[\aa]\aa|
\ExNorm*|\StrBefore{}{a}[\aa]\aa|
\ExNorm*|\StrBefore{}{}[\aa]\aa|

\chapitre{La macro}{StrBehind}

\ExNorm|\StrBehind{abcedef}{e}|
\ExNorm*|\StrBehind{abcdef}{a}|
\ExNorm*|\StrBehind{abcdef}{z}|
\ExNorm*|\StrBehind{a b c d}{c}|
\ExNorm*|\StrBehind{a b c d}{ }|
\ExNorm*|\StrBehind[2]{a b c d}{ }|
\ExNorm*|\StrBehind[3]{a b c d}{ }|
\ExNorm*|\StrBehind[9]{a b c d}{ }|
\ExNorm*|\StrBehind[-7]{a b c d}{ }|
\ExNorm*|\StrBehind{abcdef}{Z}|
\ExNorm|\StrBehind{éàèï}{è}|
\ExNorm|\StrBehind{ÉÀÇ}{À}|
\ExNorm|\StrBehind[1]{aaaaaa}{aa}|
\ExNorm|\StrBehind[2]{aaaaaa}{aa}|
\ExNorm*|\StrBehind[3]{aaaaaa}{aa}|
\ExNorm*|\StrBehind[4]{aaaaaa}{aa}|
% \ExNorm*|\StrBehind{a}{}|
% \ExNorm*|\StrBehind{}{a}|
% \ExNorm*|\StrBehind{}{}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrBehind{abcedef}{e}[\aa]\aa|
\ExNorm*|\StrBehind{abcdef}{a}[\aa]\aa|
\ExNorm*|\StrBehind{abcdef}{z}[\aa]\aa|
\ExNorm*|\StrBehind{a b c d}{c}[\aa]\aa|
\ExNorm*|\StrBehind{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBehind[2]{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBehind[3]{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBehind[9]{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBehind[-7]{a b c d}{ }[\aa]\aa|
\ExNorm*|\StrBehind{abcdef}{Z}[\aa]\aa|
\ExNorm|\StrBehind{éàèï}{è}[\aa]\aa|
\ExNorm|\StrBehind{ÉÀÇ}{À}[\aa]\aa|
\ExNorm|\StrBehind[1]{aaaaaa}{aa}[\aa]\aa|
\ExNorm|\StrBehind[2]{aaaaaa}{aa}[\aa]\aa|
\ExNorm*|\StrBehind[3]{aaaaaa}{aa}[\aa]\aa|
\ExNorm*|\StrBehind[4]{aaaaaa}{aa}[\aa]\aa|
\ExNorm*|\StrBehind{a}{}[\aa]\aa|
\ExNorm*|\StrBehind{}{a}[\aa]\aa|
\ExNorm*|\StrBehind{}{}[\aa]\aa|

\chapitre{La macro}{StrBetween}

\ExNorm|\StrBetween{abcdef}{b}{e}|
\ExNorm*|\StrBetween{aZaaaaZa}{Z}{Z}|
\ExNorm*|\StrBetween[1,2]{aZaaaaZa}{Z}{Z}|
\ExNorm*|\StrBetween{a b c d}{a}{c}|
\ExNorm*|\StrBetween{a b c d}{a }{ d}|
\ExNorm*|\StrBetween{abcdef}{a}{Z}|
\ExNorm*|\StrBetween{abcdef}{Y}{Z}|
\ExNorm*|\StrBetween[2,5]{aAaBaCaDa}{a}{a}|
\ExNorm*|\StrBetween[4,1]{ab1ab2ab3ab4ab}{b}{a}|
\ExNorm*|\StrBetween[3,4]{a b c d e f}{ }{ }|
\ExNorm|\StrBetween[1,3]{aaaaaa}{aa}{aa}|
\ExNorm|\StrBetween{éàèï}{é}{ï}|
\ExNorm|\StrBetween{ÉÀÇ}{É}{Ç}|
\ExNorm*|\StrBetween{abcdef}{a}{}|
\ExNorm*|\StrBetween{abcdef}{}{f}|
\ExNorm*|\StrBetween{}{a}{b}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrBetween{abcdef}{b}{e}[\aa]\aa|
\ExNorm*|\StrBetween{aZaaaaZa}{Z}{Z}[\aa]\aa|
\ExNorm*|\StrBetween[1,2]{aZaaaaZa}{Z}{Z}[\aa]\aa|
\ExNorm*|\StrBetween{a b c d}{a}{c}[\aa]\aa|
\ExNorm*|\StrBetween{a b c d}{a }{ d}[\aa]\aa|
\ExNorm*|\StrBetween{abcdef}{a}{Z}[\aa]\aa|
\ExNorm*|\StrBetween{abcdef}{Y}{Z}[\aa]\aa|
\ExNorm*|\StrBetween[2,5]{aAaBaCaDa}{a}{a}[\aa]\aa|
\ExNorm*|\StrBetween[4,1]{ab1ab2ab3ab4ab}{b}{a}[\aa]\aa|
\ExNorm*|\StrBetween[3,4]{a b c d e f}{ }{ }[\aa]\aa|
\ExNorm|\StrBetween[1,3]{aaaaaa}{aa}{aa}[\aa]\aa|
\ExNorm|\StrBetween{éàèï}{é}{ï}[\aa]\aa|
\ExNorm|\StrBetween{ÉÀÇ}{É}{Ç}[\aa]\aa|
\ExNorm*|\StrBetween{abcdef}{a}{}[\aa]\aa|
\ExNorm*|\StrBetween{abcdef}{}{f}[\aa]\aa|
\ExNorm*|\StrBetween{}{a}{b}[\aa]\aa|

\chapitre{La macro}{StrSubstitute}

\ExNorm|\StrSubstitute{abcdef}{c}{ZZ}|
\ExNorm|\StrSubstitute{aaaaaaa}{aa}{w}|
\ExNorm|\StrSubstitute[0]{abacada}{a}{.}|
\ExNorm|\StrSubstitute[1]{abacada}{a}{.}|
\ExNorm|\StrSubstitute[2]{abacada}{a}{.}|
\ExNorm|\StrSubstitute[3]{abacada}{a}{.}|
\ExNorm|\StrSubstitute[4]{abacada}{a}{.}|
\ExNorm|\StrSubstitute[5]{abacada}{a}{.}|
\ExNorm|\StrSubstitute{a b c d e}{ }{,}|
\ExNorm|\StrSubstitute{a b c d e}{ }{}|
\ExNorm|\StrSubstitute{éàèï}{è}{Z}|
\ExNorm|\StrSubstitute{ÉÀÇ}{Ç}{c}|
\ExNorm|\StrSubstitute{abcdef}{}{A}|
\ExNorm|\StrSubstitute{abcdef}{}{}|
\ExNorm*|\StrSubstitute{}{a}{b}|
\ExNorm*|\StrSubstitute{}{}{}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrSubstitute{abcdef}{c}{ZZ}[\aa]\aa|
\ExNorm|\StrSubstitute{aaaaaaa}{aa}{w}[\aa]\aa|
\ExNorm|\StrSubstitute[0]{abacada}{a}{.}[\aa]\aa|
\ExNorm|\StrSubstitute[1]{abacada}{a}{.}[\aa]\aa|
\ExNorm|\StrSubstitute[2]{abacada}{a}{.}[\aa]\aa|
\ExNorm|\StrSubstitute[3]{abacada}{a}{.}[\aa]\aa|
\ExNorm|\StrSubstitute[4]{abacada}{a}{.}[\aa]\aa|
\ExNorm|\StrSubstitute[5]{abacada}{a}{.}[\aa]\aa|
\ExNorm|\StrSubstitute{a b c d e}{ }{,}[\aa]\aa|
\ExNorm|\StrSubstitute{a b c d e}{ }{}[\aa]\aa|
\ExNorm|\StrSubstitute{éàèï}{è}{Z}[\aa]\aa|
\ExNorm|\StrSubstitute{ÉÀÇ}{Ç}{c}[\aa]\aa|
\ExNorm|\StrSubstitute{abcdef}{}{A}[\aa]\aa|
\ExNorm|\StrSubstitute{abcdef}{}{}[\aa]\aa|
\ExNorm*|\StrSubstitute{}{a}{b}[\aa]\aa|
\ExNorm*|\StrSubstitute{}{}{}[\aa]\aa|

\chapitre{La macro}{StrDel}

\ExNorm|\StrDel{a1a2a3a4}{a}|
\ExNorm|\StrDel[2]{a1a2a3a4}{a}|
\ExNorm|\StrDel[-2]{a1a2a3a4}{a}|
\ExNorm|\StrDel[10]{a1a2a3a4}{a}|
\ExNorm|\StrDel[3]{a b c d e}{a}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrDel{a1a2a3a4}{a}[\aa]\aa|
\ExNorm|\StrDel[2]{a1a2a3a4}{a}[\aa]\aa|
\ExNorm|\StrDel[-2]{a1a2a3a4}{a}[\aa]\aa|
\ExNorm|\StrDel[10]{a1a2a3a4}{a}[\aa]\aa|
\ExNorm|\StrDel[3]{a b c d e}{a}[\aa]\aa|

\chapitre{La macro}{StrLen}


\ExNorm|\StrLen{abcdef}|
\ExNorm|\StrLen{a b c}|
\ExNorm|\StrLen{ a b c }|
\ExNorm|\StrLen{a}|
\ExNorm|\StrLen{éàèï}|% fonctionne mal en utf8 : donne 8 au lieu de 4
\ExNorm|\StrLen{ÉÀÇ}|% idem
\ExNorm|\StrLen{}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrLen{abcdef}[\aa]\aa|
\ExNorm|\StrLen{a b c}[\aa]\aa|
\ExNorm|\StrLen{ a b c }[\aa]\aa|
\ExNorm|\StrLen{a}[\aa]\aa|
\ExNorm|\StrLen{éàèï}[\aa]\aa|% fonctionne mal en utf8 : donne 8 au lieu de 4
\ExNorm|\StrLen{ÉÀÇ}[\aa]\aa|% idem
\ExNorm|\StrLen{}[\aa]\aa|

\chapitre{la macro}{StrMid}

\ExNorm|\StrMid{abcdef}{2}{5}|
\ExNorm*|\StrMid{a b c d}{2}{6}|
\ExNorm*|\StrMid{abcdef}{4}{2}|
\ExNorm|\StrMid{abcdef}{-4}{3}|
\ExNorm*|\StrMid{abcdef}{-4}{-1}|
\ExNorm|\StrMid{abcdef}{-4}{20}|
\ExNorm*|\StrMid{abcdef}{8}{10}|
\ExNorm|\StrMid{abcdef}{2}{2}|
\ExNorm|\StrMid{éàèï}{2}{3}|
\ExNorm|\StrMid{ÉÀÇ}{2}{3}|
\ExNorm|\StrMid{aaaaaa}{3}{6}|
\ExNorm*|\StrMid{}{4}{5}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrMid{abcdef}{2}{5}[\aa]\aa|
\ExNorm*|\StrMid{a b c d}{2}{6}[\aa]\aa|
\ExNorm*|\StrMid{abcdef}{4}{2}[\aa]\aa|
\ExNorm|\StrMid{abcdef}{-4}{3}[\aa]\aa|
\ExNorm*|\StrMid{abcdef}{-4}{-1}[\aa]\aa|
\ExNorm|\StrMid{abcdef}{-4}{20}[\aa]\aa|
\ExNorm*|\StrMid{abcdef}{8}{10}[\aa]\aa|
\ExNorm|\StrMid{abcdef}{2}{2}[\aa]\aa|
\ExNorm|\StrMid{éàèï}{2}{3}[\aa]\aa|
\ExNorm|\StrMid{ÉÀÇ}{2}{3}[\aa]\aa|
\ExNorm|\StrMid{aaaaaa}{3}{6}[\aa]\aa|
\ExNorm*|\StrMid{}{4}{5}[\aa]\aa|

\chapitre{La macro}{StrGobbleLeft}

\ExNorm|\StrGobbleLeft{abcdef}{3}|
\ExNorm*|\StrGobbleLeft{a b c d}{3}|
\ExNorm|\StrGobbleLeft{abcdef}{-3}|
\ExNorm*|\StrGobbleLeft{abcdef}{9}|
\ExNorm|\StrGobbleLeft{éàèï}{2}|
\ExNorm|\StrGobbleLeft{ÉÀÇ}{1}|
\ExNorm|\StrGobbleLeft{aaaaa}{4}|
\ExNorm*|\StrGobbleLeft{}{2}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrGobbleLeft{abcdef}{3}[\aa]\aa|
\ExNorm*|\StrGobbleLeft{a b c d}{3}[\aa]\aa|
\ExNorm|\StrGobbleLeft{abcdef}{-3}[\aa]\aa|
\ExNorm*|\StrGobbleLeft{abcdef}{9}[\aa]\aa|
\ExNorm|\StrGobbleLeft{éàèï}{2}[\aa]\aa|
\ExNorm|\StrGobbleLeft{ÉÀÇ}{1}[\aa]\aa|
\ExNorm|\StrGobbleLeft{aaaaa}{4}[\aa]\aa|
\ExNorm*|\StrGobbleLeft{}{2}[\aa]\aa|

\chapitre{La macro}{StrGobbleRight}

\ExNorm|\StrGobbleRight{abcdef}{3}|
\ExNorm*|\StrGobbleRight{a b c d}{3}|
\ExNorm|\StrGobbleRight{abcdef}{-3}|
\ExNorm*|\StrGobbleRight{abcdef}{9}|
\ExNorm|\StrGobbleRight{éàèï}{2}|
\ExNorm|\StrGobbleRight{ÉÀÇ}{1}|
\ExNorm|\StrGobbleRight{aaaaa}{4}|
\ExNorm*|\StrGobbleRight{}{2}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrGobbleRight{abcdef}{3}[\aa]\aa|
\ExNorm*|\StrGobbleRight{a b c d}{3}[\aa]\aa|
\ExNorm|\StrGobbleRight{abcdef}{-3}[\aa]\aa|
\ExNorm*|\StrGobbleRight{abcdef}{9}[\aa]\aa|
\ExNorm|\StrGobbleRight{éàèï}{2}[\aa]\aa|
\ExNorm|\StrGobbleRight{ÉÀÇ}{1}[\aa]\aa|
\ExNorm|\StrGobbleRight{aaaaa}{4}[\aa]\aa|
\ExNorm*|\StrGobbleRight{}{2}[\aa]\aa|

\chapitre{La macro}{StrLeft}

\ExNorm|\StrLeft{abcdef}{3}|
\ExNorm*|\StrLeft{a b c d}{3}|
\ExNorm*|\StrLeft{abcdef}{-3}|
\ExNorm*|\StrLeft{abcdef}{9}|
\ExNorm|\StrLeft{éàèï}{2}|
\ExNorm|\StrLeft{ÉÀÇ}{1}|
\ExNorm|\StrLeft{aaaaa}{4}|
\ExNorm*|\StrLeft{}{2}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrLeft{abcdef}{3}[\aa]\aa|
\ExNorm*|\StrLeft{a b c d}{3}[\aa]\aa|
\ExNorm*|\StrLeft{abcdef}{-3}[\aa]\aa|
\ExNorm*|\StrLeft{abcdef}{9}[\aa]\aa|
\ExNorm|\StrLeft{éàèï}{2}[\aa]\aa|
\ExNorm|\StrLeft{ÉÀÇ}{1}[\aa]\aa|
\ExNorm|\StrLeft{aaaaa}{4}[\aa]\aa|
\ExNorm*|\StrLeft{}{2}[\aa]\aa|

\chapitre{La macro}{StrRight}

\ExNorm|\StrRight{abcdef}{3}|
\ExNorm*|\StrRight{a b c d}{3}|
\ExNorm*|\StrRight{abcdef}{-3}|
\ExNorm*|\StrRight{abcdef}{9}|
\ExNorm|\StrRight{éàèï}{2}|
\ExNorm|\StrRight{ÉÀÇ}{1}|
\ExNorm|\StrRight{aaaaa}{4}|
\ExNorm*|\StrRight{}{2}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrRight{abcdef}{3}[\aa]\aa|
\ExNorm*|\StrRight{a b c d}{3}[\aa]\aa|
\ExNorm*|\StrRight{abcdef}{-3}[\aa]\aa|
\ExNorm*|\StrRight{abcdef}{9}[\aa]\aa|
\ExNorm|\StrRight{éàèï}{2}[\aa]\aa|
\ExNorm|\StrRight{ÉÀÇ}{1}[\aa]\aa|
\ExNorm|\StrRight{aaaaa}{4}[\aa]\aa|
\ExNorm*|\StrRight{}{2}[\aa]\aa|

\chapitre{la macro}{StrChar}

\ExNorm|\StrChar{abcdef}{5}|
\ExNorm*|\StrChar{a b c d}{4}|
\ExNorm|\StrChar{a b c d}{7}|
\ExNorm*|\StrChar{abcdef}{10}|
\ExNorm*|\StrChar{abcdef}{-5}|
\ExNorm*|\StrChar{}{3}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrChar{abcdef}{5}[\aa]\aa|
\ExNorm*|\StrChar{a b c d}{4}[\aa]\aa|
\ExNorm|\StrChar{a b c d}{7}[\aa]\aa|
\ExNorm*|\StrChar{abcdef}{10}[\aa]\aa|
\ExNorm*|\StrChar{abcdef}{-5}[\aa]\aa|
\ExNorm*|\StrChar{}{3}[\aa]\aa|

\chapitre{La macro}{StrCount}

\ExNorm|\StrCount{abcdef}{d}|
\ExNorm|\StrCount{a b c d}{ }|
\ExNorm|\StrCount{aaaaaa}{aa}|
\ExNorm|\StrCount{étété}{é}|
\ExNorm|\StrCount{abcdef}{Z}|
\ExNorm|\StrCount{éàèï}{é}|
\ExNorm|\StrCount{ÉÀÇ}{Ç}|
\ExNorm|\StrCount{abcdef}{}|
\ExNorm|\StrCount{}{a}|
\ExNorm|\StrCount{}{}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrCount{abcdef}{d}[\aa]\aa|
\ExNorm|\StrCount{a b c d}{ }[\aa]\aa|
\ExNorm|\StrCount{aaaaaa}{aa}[\aa]\aa|
\ExNorm|\StrCount{étété}{é}[\aa]\aa|
\ExNorm|\StrCount{abcdef}{Z}[\aa]\aa|
\ExNorm|\StrCount{éàèï}{é}[\aa]\aa|
\ExNorm|\StrCount{ÉÀÇ}{Ç}[\aa]\aa|
\ExNorm|\StrCount{abcdef}{}[\aa]\aa|
\ExNorm|\StrCount{}{a}[\aa]\aa|
\ExNorm|\StrCount{}{}[\aa]\aa|

\chapitre{La macro}{StrPosition}

\ExNorm|\StrPosition{abcdef}{c}|
\ExNorm|\StrPosition{abcdef}{Z}|
\ExNorm|\StrPosition{a b c d}{ }|
\ExNorm|\StrPosition[3]{a b c d}{ }|
\ExNorm|\StrPosition[8]{a b c d}{ }|
\ExNorm|\StrPosition{étété}{é}|
\ExNorm|\StrPosition[3]{étété}{é}|
\ExNorm|\StrPosition[5]{étété}{é}|
\ExNorm|\StrPosition{aaaaaa}{aa}|
\ExNorm|\StrPosition[2]{aaaaaa}{aa}|
\ExNorm|\StrPosition[3]{aaaaaa}{aa}|
\ExNorm|\StrPosition{éàèï}{è}|
\ExNorm|\StrPosition{ÉÀÇ}{À}|
\ExNorm|\StrPosition{abcdef}{}|
\ExNorm|\StrPosition{}{a}|
\ExNorm|\StrPosition{}{}|
\par\bigskip Mêmes exemples avec l'argument optionnel :

\ExNorm|\StrPosition{abcdef}{c}[\aa]\aa|
\ExNorm|\StrPosition{abcdef}{Z}[\aa]\aa|
\ExNorm|\StrPosition{a b c d}{ }[\aa]\aa|
\ExNorm|\StrPosition[3]{a b c d}{ }[\aa]\aa|
\ExNorm|\StrPosition[8]{a b c d}{ }[\aa]\aa|
\ExNorm|\StrPosition{étété}{é}[\aa]\aa|
\ExNorm|\StrPosition[3]{étété}{é}[\aa]\aa|
\ExNorm|\StrPosition[5]{étété}{é}[\aa]\aa|
\ExNorm|\StrPosition{aaaaaa}{aa}[\aa]\aa|
\ExNorm|\StrPosition[2]{aaaaaa}{aa}[\aa]\aa|
\ExNorm|\StrPosition[3]{aaaaaa}{aa}[\aa]\aa|
\ExNorm|\StrPosition{éàèï}{è}[\aa]\aa|
\ExNorm|\StrPosition{ÉÀÇ}{À}[\aa]\aa|
\ExNorm|\StrPosition{abcdef}{}[\aa]\aa|
\ExNorm|\StrPosition{}{a}[\aa]\aa|
\ExNorm|\StrPosition{}{}[\aa]\aa|
\end{document}