summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/xstring/README51
-rw-r--r--Master/texmf-dist/doc/latex/xstring/xstring_doc_en.pdfbin0 -> 169550 bytes
-rw-r--r--Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex1194
-rw-r--r--Master/texmf-dist/doc/latex/xstring/xstring_doc_fr.pdfbin0 -> 180189 bytes
-rwxr-xr-xMaster/texmf-dist/doc/latex/xstring/xstring_doc_fr.tex1192
-rwxr-xr-xMaster/texmf-dist/doc/latex/xstring/xstring_test.pdfbin0 -> 45911 bytes
-rwxr-xr-xMaster/texmf-dist/doc/latex/xstring/xstring_test.tex552
-rw-r--r--Master/texmf-dist/tex/latex/xstring/xstring.sty704
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/xstring.tlpsrc2
11 files changed, 3697 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/xstring/README b/Master/texmf-dist/doc/latex/xstring/README
new file mode 100644
index 00000000000..e057dd49d3b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xstring/README
@@ -0,0 +1,51 @@
+ _________________
+
+ xstring package
+ v1.0
+ _________________
+
+This package provides macros manipulating strings, such as:
+ * tests:
+ - does a string contains at least n times an another?
+ - does a string starts (or ends) with another? etc.
+ * extractions of substrings:
+ - what is on the left (or the right) of the nth occurrence of a
+ substring;
+ - what is between the occurrences of 2 substrings;
+ - substring between 2 positions, etc.
+ * substitution of all (or the n first) occurrences of a substring
+ for an other substring;
+ * calculation of numbers:
+ - length of a string;
+ - position of the nth occurrence of a substring;
+ - how many times a string contains a substring?
+
+For programming purposes, other macros allow to use special characters
+(& ~ \ { } _ # $ ^ %) with the macros manipulating strings.
+
+#######################################################################
+
+Cette extension regroupe un ensemble de macros manipulant des chaînes
+de caractères :
+ * des tests :
+ - une chaîne en contient elle une autre au moins n fois ?
+ - une chaîne commence t-elle ou finit-elle par une autre ? etc.
+ * des extractions de chaines :
+ - renvoi de ce qui se trouve avant (ou après) la nieme occurrence
+ d'une sous-chaîne;
+ - renvoi de ce qui se trouve entre les occurrences de 2 sous-chaînes;
+ - sous-chaîne comprise entre 2 positions, etc.
+ * le remplacement de toutes ou des n premières occurrences d'une
+ sous-chaîne par une autre sous-chaîne;
+ * des calculs de nombres :
+ - longueur d'une chaîne;
+ - position de la la nieme occurrence d'une sous-chaîne;
+ - comptage du nombre d'occurrences d'une sous-chaîne dans une autre.
+
+D'autres commandes permettent de traiter les caractères spéciaux
+(& ~ \ { } _ # $ ^ %) de façon à les utiliser dans les arguments des macros
+de ce package, ce qui permet d'utiliser ces macros à fins de programmation.
+
+
+ C Tellechea
+ <unbonpetit@gmail.com> \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.pdf b/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.pdf
new file mode 100644
index 00000000000..c1c836c875a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex b/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex
new file mode 100644
index 00000000000..0e77624f27e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex
@@ -0,0 +1,1194 @@
+\documentclass[a4paper,10pt]{article}
+\usepackage{xstring}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[dvips,colorlinks=true,hyperfootnotes=false,citecolor=black,filecolor=black,linkcolor=blue,urlcolor=blue,bookmarks=false,pdfauthor={Christian Tellechea},pdftitle={xstring},pdfsubject={package for strings},pdfkeywords={xstring,latex,string},pdfcreator={LaTeX}]{hyperref}
+\usepackage[a4paper,dvips,margin=2cm]{geometry}
+\usepackage{amsmath,amssymb,amsfonts,textcomp}
+\usepackage{amssymb}
+\usepackage{moreverb}
+\usepackage{lmodern}
+\usepackage{eurosym}
+\usepackage{xstring}
+\usepackage[french,english]{babel}
+\makeatletter
+
+\newcommand*\Exemple{\@ifstar{\def\frontiere{|}\@Ex}{\def\frontiere{}\@Ex}}
+% la macro de Ulrich Diez
+\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{\@ehc}%
+ \aftergroup\verb@balance@group%
+ \lowercase{%
+ \let ~\verb@egroup%
+ \def\@tempa##1~{\hbox to \Partage\linewidth{\hfil##1~}\quad\scantokens{\frontiere##1\frontiere}\par}}%
+ \@tempa}%
+\makeatother
+\newcommand\guill[1]{"#1"}
+\newcommand\argu[1]{$\langle$\textit{#1}$\rangle$}
+\newcommand\ARGU[1]{\texttt{\{}\argu{#1}\texttt{\}}}
+\newcommand\arguC[1]{\texttt{[}\argu{#1}\texttt{]}}
+\newcommand\arguCC[2]{\texttt{[}\argu{#1}{,}\argu{#2}\texttt{]}}
+\newcommand\texte[1]{\texttt{text}${}_{#1}$}
+\newcommand\voirdeftexte{~(see \ref{deftexte})}
+\newenvironment{Conditions}[1][1cm]%
+{\begin{list}%
+ {$\vartriangleright$}%
+ {\setlength{\leftmargin}{#1}
+ \setlength{\itemsep}{0pt}
+ \setlength{\parsep}{0pt}
+ \setlength{\topsep}{2ptplus3ptminus2pt}
+ }}%
+{\end{list}}
+\renewcommand\th{${}^\text{th}$}
+
+\begin{document}
+\gdef\Partage{0.7}
+\setlength{\parindent}{0cm}
+\begin{titlepage}
+ \null\par\vfill
+ \begin{center}
+ \begin{minipage}{0.75\linewidth}
+ \begin{center}
+ \Huge\bfseries xstring\par\vspace{5pt}
+ \small v1.0\par\vspace{25pt}
+ \normalsize User's manual
+ \end{center}
+ \end{minipage}
+ \end{center}
+ \vspace{1cm}
+ \begin{center}
+ Christian {\sc Tellechea}\par\small
+ \href{mailto:unbonpetit@gmail.com}{\nolinkurl{unbonpetit@gmail.com}}\par\vspace{5pt}
+ July 6\th{} 2008
+ \end{center}
+ \vfill\hrulefill
+ \begin{center}
+ \begin{minipage}{0.85\linewidth}
+ \noindent
+ \hfill\textbf{\textit{Abstract}}\hfill{}\medskip\par
+ This package groups together macros manipulating strings, such as:
+ \setlength{\parindent}{1.5em}
+ \begin{itemize}
+ \item[$\triangleright$] tests:
+ \begin{itemize}
+ \item does a string contains at least $n$ times an another?
+ \item does a string starts (or ends) with another? etc.
+ \end{itemize}
+ \item[$\triangleright$] extractions of substrings:
+ \begin{itemize}
+ \item what is on the left (or the right) of the $n$\th{} occurrence of a substring;
+ \item what is between the occurrences of 2 substrings;
+ \item substring between 2 positions, etc.
+ \end{itemize}
+ \item[$\triangleright$] substitution of all, or the $n$ first occurrences of a substring for an other substring;
+ \item[$\triangleright$] calculation of numbers:
+ \begin{itemize}
+ \item length of a string;
+ \item position of the $n$\th{} occurrence of a substring;
+ \item how many times a string contains a substring?
+ \end{itemize}
+ \end{itemize}
+ \medskip
+ For programming purposes, other macros allow to use special characters (\verb|&|, \verb|~|, \verb|\|, \verb|{|, \verb|}|, \verb|_|, \verb|#|, \verb|$|, \verb|^| and \verb|%|) with the macros manipulating strings.
+ \end{minipage}
+ \end{center}
+ \hrulefill\vfill{}
+\end{titlepage}
+\pagebreak
+\tableofcontents
+\pagebreak
+
+This manual is a translation of the french manual. I apologize for my poor english but I did my best, and I hope that the following is comprehensible!
+\section{Presentation}
+\subsection{Description}
+This extension provides macros and tests operating on strings, as other programmation languages have. They provides the usual strings operations, such as: test if a string contains another, begins or ends with another, extractions of strings, calculation of the position of a substring, of the number of occurrences, etc.\medskip
+
+Certainly, other packages exit (for example \href{http://www.ctan.org/tex-archive/macros/latex/contrib/substr/}{\nolinkurl{substr}} and \href{http://www.ctan.org/tex-archive/macros/latex/contrib/stringstrings/}{\nolinkurl{stringstrings}}), but as well as differences on features, they do not take into account occurrences so I found them too limited and difficult to use for programming.
+
+\subsection{Motivation}
+I decided to write this package of macros because I have never really found tools in \LaTeX{} suiting my needs for strings. So, over the last few months,I wrote a few macros that I occasionally or regularly used. Their numbers have increased and become a little too dispersed in directories in my computer, so I have grouped them together in this package.
+
+Thus, writing a coherent set of macros forces more discipline and leads to necessary improvements, which took most of the time I spent writing this package.\medskip
+
+This package is my first one as I discoverd \LaTeX{} less than a year ago, so my main motivation was to make progress in programming with \TeX, and to tackle its specific methods.
+
+\subsection{Operation}
+\label{deftexte}
+In the following, \guill{\texte{10,11,12}} means a string made of characters whose catcodes are 10, 11 or 12.
+\subsubsection{Expansion of arguments}
+\label{devarg}
+All the arguments of the macros operating on strings\footnote{Excepted the 2 last arguments of the tests.} are supposed, after a number of times of expansion, to expand to \texte{10,11,12}. By \emph{default}, to avoid many \verb|\expandafter| and to ease the use of macros, all the arguments are fully expanded before being taken into account by the macro: for this, \verb|\fullexpandarg| is called by default.\bigskip
+
+For example, if \verb|\macro| is a macro of this package requiring 2 arguments (text for the first and a number for the second), the following structures are equivalent:\medskip
+
+\begin{minipage}[t]{0.35\linewidth}
+ Structure with \verb|\fullexpandarg|\par\hrulefill\par
+ \verb|\def\aa{some text}|\par
+ \verb|\def\nn{2}|\par
+ \verb|\macro{\aa}{\nn}|
+\end{minipage}
+\hfill
+\begin{minipage}[t]{0.6\linewidth}
+ Usual structure with \LaTeX{} or with \verb|\normalexpandarg|\par\hrulefill\par
+ \verb|\def\aa{some text}|\par
+ \verb|\def\nn{2}|\par
+ \verb|\expandafter\expandafter\expandafter\macro|\par
+ \verb| \expandafter\expandafter\expandafter|\par
+ \verb| {\expandafter\aa\expandafter}\expandafter{\nn}|
+\end{minipage}\hfill{}\medskip
+
+The structure on the left allow to forget the order of expansion and avoid writing many \verb|\expandafter|. On the other hand, the arguments must be purely expandable into \texte{10,11,12} containing what is expected by the macro (number or string).\medskip
+
+However, at any time, you can find the usual order of expansion with the macro \verb|\normalexpandarg|, and use again \verb|\fullexpandarg| if you want a full expansion of the arguments.
+
+\subsubsection{Textual arguments}
+The macros operating on strings require one or several arguments containing --~or whose expansion contains~-- \texte{10,11,12}\voirdeftexte{}, using the usual syntax \verb|{|\texte{10,11,12}\verb|}|, and for optionnal arguments \verb|[|\texte{10,11,12}\verb|]|.\medskip
+
+The following rules shoud be observed for the expansion of textual arguments:
+
+\begin{itemize}
+ \item they can contain letters (uppercase or lowercase, accented\footnote{For a reliable operation with accented letters, the \texttt{\textbackslash fontenc} package with option \texttt{[T1]} and \texttt{\textbackslash inputenc} with appropriated option must be loaded} or not), figures, spaces, and any other character with a catcode of 10, 11 ou 12 (punctuation signs, calculation signs, parenthesis, square bracket, etc). On the other hand, the \officialeuro{} sign is not allowed.
+ \item spaces are taken into account as normal characters, except if several spaces follows in which case the \LaTeX{} rule prevails and they become a single space;
+ \item no special character is allowed, i.e. the 10 following characters are strictly forbiden: \verb|&|, \verb|~|, \verb|\|, \verb|{|, \verb|}|, \verb|_|, \verb|#|, \verb|$|, \verb|^| and \verb|%|.
+\end{itemize}\medskip
+
+To circumvent some of these rules and to go further in the use of the macros operating on strings, this package provides special macros that enable special characters in textual arguments. See the detailed description of this modus operandi in chapter~\ref{programmation}, page~\pageref{programmation}.
+
+\subsubsection{Expansion of macros, optional argument}
+The macros of this package are not purely expandable, i.e. they cannot be put in the argument of an \verb|\edef|. Consequently, some structures are not allowed and lead to errors when compiling. If, for example, \verb|\command{argument}| is a macro of this package operating on strings and returning a string, the following structures are not allowed:\smallskip
+
+\hspace{0.2\linewidth}\verb|\edef\Result{\command{argument}}|\par
+\qquad or this nested structure\par
+\hspace{0.2\linewidth}\verb|\commandA{\commandB{\commandC{argument}}}|\smallskip
+
+For this reason, all the macros returning a result (i.e. all excepted the tests) have an optionnal argument in last position. The syntax is \arguC{nom}, where \argu{nom} is the name of the control sequence that will receive the result of the macro: the assignment is made with an \verb|\edef| which make the result of the macro |\argu{nom} purely expandable. Of course, if an optionnal argument is present, the macro does not display anything.\medskip
+
+Thus, this structure not allowed, already seen above:\par
+\hspace{0.2\linewidth}\verb|\edef\Resultat{\commande{arguments}}|\par
+\qquad is equivalent to:\par
+\hspace{0.2\linewidth}\verb|\commande{argument}[\Resultat]|\medskip
+
+And this nested one:\par
+\hspace{0.2\linewidth}\verb|\commandeA{\commandeB{\commandeC{arguments}}}|\par
+\qquad can be replaced by:\par
+\hspace{0.2\linewidth}\verb|\commandeC{arguments}[\MaChaine]|\par
+\hspace{0.2\linewidth}\verb|\commandeB{\MaChaine}[\MaChaine]|\par
+\hspace{0.2\linewidth}\verb|\commandeA{\MaChaine}|
+
+\section{The macros}
+\label{listemacros}
+\subsection{Presentation of macros}
+In the following chapters, all the macros will be presented this plan:\smallskip
+
+\begin{itemize}
+ \item the syntax and the value of optional arguments
+ \item a short description of the operation;
+ \item the operation under special conditions. For each conditions considered, the operation described has priority on that (those) below;
+ \item finally, several examples are given. I tried to find them most easily comprehensible and most representative of the situations met in normal use\footnote{For more examples, see the test file.}. If a doubt is possible with spaces in the result, this one will be delimited by \guill{|}, given that an empty string is represented by \guill{||}.
+\end{itemize}
+
+\subsection{The tests}
+\subsubsection{IfSubStr}
+\verb|\IfSubStr|\arguC{number}\ARGU{string}\ARGU{stringA}\ARGU{true}\ARGU{false}
+\smallskip
+
+The value of the optional argument \argu{number} is 1 by default.\par\smallskip
+
+Tests if \argu{string} contains at least \argu{number} times \argu{stringA} and runs \argu{true} if so, and \argu{false} otherwise.\medskip
+
+\begin{Conditions}
+\item If \argu{number}${}\leqslant0$, runs \argu{false};
+\item If \argu{string} or \argu{stringA} is empty, runs \argu{false}.
+\end{Conditions}
+
+\Exemple|\IfSubStr{xstring}{tri}{true}{false}|
+\Exemple|\IfSubStr{xstring}{a}{true}{false}|
+\Exemple|\IfSubStr{a bc def }{c d}{true}{false}|
+\Exemple|\IfSubStr{a bc def }{cd}{true}{false}|
+\Exemple|\IfSubStr[2]{1a2a3a}{a}{true}{false}|
+\Exemple|\IfSubStr[3]{1a2a3a}{a}{true}{false}|
+\Exemple|\IfSubStr[4]{1a2a3a}{a}{true}{false}|
+
+\subsubsection{IfSubStrBefore}
+\verb|\IfSubStrBefore|\arguCC{number1}{number2}\ARGU{string}\ARGU{stringA}\ARGU{stringB}\ARGU{true}\ARGU{false}
+\smallskip
+
+The values of the optional arguments \argu{number1} and \argu{number2} are 1 by default.\par\smallskip
+
+In \argu{string}, tests if the \argu{number1}\th{} occurrence of \argu{stringA} is on the left of the \argu{number2}\th{} occurrence of \argu{stringB}. Runs \argu{true} if so, and \argu{false} otherwise.\medskip
+
+\begin{Conditions}
+\item If one of the occurrences is not found, it runs \argu{false};
+\item If one of the arguments \argu{string}, \argu{stringA} or \argu{stringB} is empty, runs \argu{false};
+\item If one of the optional arguments is negative or zero, runs \argu{false}.
+\end{Conditions}
+
+\Exemple|\IfSubStrBefore{xstring}{st}{in}{true}{false}|
+\Exemple|\IfSubStrBefore{xstring}{ri}{s}{true}{false}|
+\Exemple|\IfSubStrBefore{LaTeX}{LaT}{TeX}{true}{false}|
+\Exemple|\IfSubStrBefore{a bc def }{ b}{ef}{true}{false}|
+\Exemple|\IfSubStrBefore{a bc def }{ab}{ef}{true}{false}|
+\Exemple|\IfSubStrBefore[2,1]{b1b2b3}{b}{2}{true}{false}|
+\Exemple|\IfSubStrBefore[3,1]{b1b2b3}{b}{2}{true}{false}|
+\Exemple|\IfSubStrBefore[2,2]{baobab}{a}{b}{true}{false}|
+\Exemple|\IfSubStrBefore[2,3]{baobab}{a}{b}{true}{false}|
+
+\subsubsection{IfSubStrBehind}
+
+\verb|\IfSubStrBehind|\arguCC{number1}{number2}\ARGU{string}\ARGU{stringA}\ARGU{stringB}\ARGU{true}\ARGU{false}
+\smallskip
+
+The values of the optional arguments \argu{number1} and \argu{number2} are 1 by default.\par\smallskip
+
+In \argu{string}, tests if the \argu{number1}\th{} occurrence of \argu{stringA} is on the right of the \argu{number2}\th{} occurrence of \argu{stringB}. Runs \argu{true} if so, ands \argu{false} otherwise.\medskip
+
+\begin{Conditions}
+\item If one of the occurrences is not found, it runs \argu{false};
+\item If one of the arguments \argu{string}, \argu{stringA} or \argu{stringB} is empty, runs \argu{false};
+\item If one of the optional arguments is negative or zero, runs \argu{false}.
+\end{Conditions}
+
+\Exemple|\IfSubStrBehind{xstring}{ri}{xs}{true}{false}|
+\Exemple|\IfSubStrBehind{xstring}{s}{i}{true}{false}|
+\Exemple|\IfSubStrBehind{LaTeX}{TeX}{LaT}{true}{false}|
+\Exemple|\IfSubStrBehind{a bc def }{ d}{a}{true}{false}|
+\Exemple|\IfSubStrBehind{a bc def }{cd}{a b}{true}{false}|
+\Exemple|\IfSubStrBehind[2,1]{b1b2b3}{b}{2}{true}{false}|
+\Exemple|\IfSubStrBehind[3,1]{b1b2b3}{b}{2}{true}{false}|
+\Exemple|\IfSubStrBehind[2,2]{baobab}{b}{a}{true}{false}|
+\Exemple|\IfSubStrBehind[2,3]{baobab}{b}{a}{true}{false}|
+
+\subsubsection{IfBeginWith}
+
+\verb|\IfBeginWith|\ARGU{string}\ARGU{stringA}\ARGU{true}\ARGU{false}
+\smallskip
+
+Tests if \argu{string} begins with \argu{stringA}, and runs \argu{true} if so, and \argu{false} otherwise.\medskip
+
+\begin{Conditions}
+\item If \argu{string} or \argu{stringA} is empty, runs \argu{false}.
+\end{Conditions}
+
+\Exemple|\IfBeginWith{xstring}{xst}{true}{false}|
+\Exemple|\IfBeginWith{LaTeX}{a}{true}{false}|
+\Exemple|\IfBeginWith{a bc def }{a b}{true}{false}|
+\Exemple|\IfBeginWith{a bc def }{ab}{true}{false}|
+
+\subsubsection{IfEndWith}
+
+\verb|\IfEndWith|\ARGU{string}\ARGU{stringA}\ARGU{Behind}\ARGU{false}
+\smallskip
+
+Tests if \argu{string} ends with \argu{stringA}, and runs \argu{true} if so, and \argu{false} otherwise.\medskip
+
+\begin{Conditions}
+\item If \argu{string} or \argu{stringA} is empty, runs \argu{false}.
+\end{Conditions}
+
+\Exemple|\IfEndWith{xstring}{ring}{true}{false}|
+\Exemple|\IfEndWith{LaTeX}{a}{true}{false}|
+\Exemple|\IfEndWith{a bc def }{ef }{true}{false}|
+\Exemple|\IfEndWith{a bc def }{ef}{true}{false}|
+
+\subsection{Extraction of substrings}
+\subsubsection{StrBefore}
+
+\verb|\StrBefore|\arguC{number}\ARGU{string}\ARGU{stringA}\arguC{name}
+\smallskip
+
+The value of the optional argument \argu{number} is 1 by default.\par\smallskip
+
+In \argu{string}, returns what is leftwards the \argu{number}\th{} occurrence of \argu{stringA}.\medskip
+
+\begin{Conditions}
+\item If \argu{string} or \argu{stringA} is empty, an empty string is returned;
+\item If \argu{number}${}<1$ then the macro behaves as if \argu{number}${}=1$;
+\item If the occurrence is not found, an empty string is returned.
+\end{Conditions}
+
+\Exemple*|\StrBefore{xstring}{tri}|
+\Exemple*|\StrBefore{LaTeX}{e}|
+\Exemple*|\StrBefore{LaTeX}{p}|
+\Exemple*|\StrBefore{LaTeX}{L}|
+\Exemple*|\StrBefore{a bc def }{def}|
+\Exemple*|\StrBefore{a bc def }{cd}|
+\Exemple*|\StrBefore[1]{1b2b3}{b}|
+\Exemple*|\StrBefore[2]{1b2b3}{b}|
+
+\subsubsection{StrBehind}
+
+\verb|\StrBehind|\arguC{number}\ARGU{string}\ARGU{stringA}\arguC{name}
+\smallskip
+
+The value of the optional argument \argu{number} is 1 by default.\par\smallskip
+
+In \argu{string}, returns what is rightwards the \argu{number}\th{} occurrence of \argu{stringA}.\medskip
+
+\begin{Conditions}
+\item If \argu{string} or \argu{stringA} is empty, an empty string is returned;
+\item If \argu{number}${}<1$ then the macro behaves as if \argu{number}${}=1$;
+\item If the occurrence is not found, an empty string is returned.
+\end{Conditions}
+
+
+\Exemple*|\StrBehind{xstring}{tri}|
+\Exemple*|\StrBehind{LaTeX}{e}|
+\Exemple*|\StrBehind{LaTeX}{p}|
+\Exemple*|\StrBehind{LaTeX}{X}|
+\Exemple*|\StrBehind{a bc def }{bc}|
+\Exemple*|\StrBehind{a bc def }{cd}|
+\Exemple*|\StrBehind[1]{1b2b3}{b}|
+\Exemple*|\StrBehind[2]{1b2b3}{b}|
+\Exemple*|\StrBehind[3]{1b2b3}{b}|
+
+\subsubsection{StrBetween}
+
+\verb|\StrBetween|\arguCC{number1}{number2}\ARGU{string}\ARGU{stringA}\ARGU{stringB}\arguC{name}
+\smallskip
+
+The values of the optional arguments \argu{number1} and \argu{number2} are 1 by default.\par\smallskip
+
+In \argu{string}, returns the substring between\footnote{In a strict sense, i.e. \emph{without} the strings \argu{stringA} and \argu{stringB}} the \argu{number1}\th{} occurrence of \argu{stringA} and \argu{number2}\th{} occurrence of \argu{stringB}.\medskip
+
+\begin{Conditions}
+\item If the occurrences are not in this order ---~\argu{stringA} \emph{followed by} \argu{stringB}~--- in \argu{string}, an empty string is returned;
+\item If one of the 2 occurrences doesn't exist in \argu{string}, an empty string is returned;
+\item If one of the optional arguments \argu{number1} ou \argu{number2} is negative or zero, an empty string is returned.
+\end{Conditions}
+
+\Exemple*|\StrBetween{xstring}{xs}{ng}|
+\Exemple*|\StrBetween{xstring}{i}{n}|
+\Exemple*|\StrBetween{xstring}{a}{tring}|
+\Exemple*|\StrBetween{a bc def }{a}{d}|
+\Exemple*|\StrBetween{a bc def }{a }{f}|
+\Exemple*|\StrBetween{a1b1a2b2a3b3}{a}{b}|
+\Exemple*|\StrBetween[2,3]{a1b1a2b2a3b3}{a}{b}|
+\Exemple*|\StrBetween[1,3]{a1b1a2b2a3b3}{a}{b}|
+\Exemple*|\StrBetween[3,1]{a1b1a2b2a3b3}{a}{b}|
+\Exemple*|\StrBetween[3,2]{abracadabra}{a}{bra}|
+
+\subsubsection{StrSubstitute}
+
+\verb|\StrSubstitute|\arguC{number}\ARGU{string}\ARGU{stringA}\ARGU{stringB}\arguC{name}
+\smallskip
+
+The value of the optional argument \argu{number} is 1 by default.\par\smallskip
+
+In \argu{string}, substitute the \argu{number} first occurrences of \argu{stringA} for \argu{stringB}, except if \argu{number}${}=0$ in which case \emph{all} the occurrences are substituted.
+
+\begin{Conditions}
+\item If \argu{string} is empty, an empty string is returned;
+\item If \argu{stringA} is empty or doesn't exist in \argu{string}, the macro is ineffective;
+\item If \argu{number} is greater than the number of occurrences of \argu{stringA}, then all the occurrences are substituted;
+\item If \argu{number}${}<0$ the macro behaves as if \argu{number}${}=0$;
+\item If \argu{stringB} is empty, the occurrences of \argu{stringA}, if they exist, are deleted.
+\end{Conditions}
+
+\Exemple|\StrSubstitute{xstring}{i}{a}|
+\Exemple|\StrSubstitute{abracadabra}{a}{o}|
+\Exemple|\StrSubstitute{abracadabra}{br}{TeX}|
+\Exemple|\StrSubstitute{LaTeX}{m}{n}|
+\Exemple|\StrSubstitute{a bc def }{ }{M}|
+\Exemple|\StrSubstitute{a bc def }{ab}{AB}|
+\Exemple|\StrSubstitute[1]{a1a2a3}{a}{B}|
+\Exemple|\StrSubstitute[2]{a1a2a3}{a}{B}|
+\Exemple|\StrSubstitute[3]{a1a2a3}{a}{B}|
+\Exemple|\StrSubstitute[4]{a1a2a3}{a}{B}|
+
+\subsubsection{StrDel}
+
+\verb|\StrDel|\arguC{number}\ARGU{string}\ARGU{stringA}\arguC{name}
+\smallskip
+
+The value of the optional argument \argu{number} is 1 by default.\par\smallskip
+
+Delete the \argu{number} first occurrences of \argu{stringA} in \argu{string}, except if \argu{number}${}=0$ in which case \emph{all} the occurrences are deleted.\medskip
+
+\begin{Conditions}
+\item If \argu{string} is empty, an empty string is returned;
+\item If \argu{stringA} is empty or doesn't exist in \argu{string}, the macro is ineffective;
+\item If \argu{number} greater then the number of occurrences of \argu{stringA}, then all the occurrences are deleted;
+\item If \argu{number}${}<0$ the macro behaves as if \argu{number}${}=0$;
+\end{Conditions}
+
+\Exemple|\StrDel{abracadabra}{a}|
+\Exemple|\StrDel[1]{abracadabra}{a}|
+\Exemple|\StrDel[4]{abracadabra}{a}|
+\Exemple|\StrDel[9]{abracadabra}{a}|
+\Exemple|\StrDel{a bc def }{ }|
+
+\subsubsection{StrGobbleLeft}
+
+\verb|\StrGobbleLeft|\ARGU{string}\ARGU{number}\arguC{name}
+\smallskip
+
+In \argu{string}, delete the \argu{number} fisrt characters on the left.\medskip
+
+\begin{Conditions}
+\item If \argu{string} is empty, an empty string is returned;
+\item If \argu{number}${}\leqslant0$, no character is deleted;
+\item If \argu{number}${}\geqslant{}$\argu{lengthString}, all the characters are deleted.
+\end{Conditions}
+
+\Exemple*|\StrGobbleLeft{xstring}{2}|
+\Exemple*|\StrGobbleLeft{xstring}{9}|
+\Exemple*|\StrGobbleLeft{LaTeX}{4}|
+\Exemple*|\StrGobbleLeft{LaTeX}{-2}|
+\Exemple*|\StrGobbleLeft{a bc def }{4}|
+
+\subsubsection{StrLeft}
+
+\verb|\StrLeft|\ARGU{string}\ARGU{number}\arguC{name}
+\smallskip
+
+In \argu{string}, returns the \argu{number} fisrt characters on the left.\medskip
+
+\begin{Conditions}
+\item If \argu{string} is empty, an empty string is returned;
+\item If \argu{number}${}\leqslant0$, no character is returned;
+\item If \argu{number}${}\geqslant{}$\argu{lengthString}, all the characters are returned.
+\end{Conditions}
+
+\Exemple*|\StrLeft{xstring}{2}|
+\Exemple*|\StrLeft{xstring}{9}|
+\Exemple*|\StrLeft{LaTeX}{4}|
+\Exemple*|\StrLeft{LaTeX}{-2}|
+\Exemple*|\StrLeft{a bc def }{5}|
+
+\subsubsection{StrGobbleRight}
+
+\verb|\StrGobbleRight|\ARGU{string}\ARGU{number}\arguC{name}
+\smallskip
+
+In \argu{string}, delete the \argu{number} last characters on the right.\medskip
+
+\Exemple*|\StrGobbleRight{xstring}{2}|
+\Exemple*|\StrGobbleRight{xstring}{9}|
+\Exemple*|\StrGobbleRight{LaTeX}{4}|
+\Exemple*|\StrGobbleRight{LaTeX}{-2}|
+\Exemple*|\StrGobbleRight{a bc def }{4}|
+
+\subsubsection{StrRight}
+
+\verb|\StrRight|\ARGU{string}\ARGU{number}\arguC{name}
+\smallskip
+
+In \argu{string}, returns the \argu{number} last characters on the right.\medskip
+
+\Exemple*|\StrRight{xstring}{2}|
+\Exemple*|\StrRight{xstring}{9}|
+\Exemple*|\StrRight{LaTeX}{4}|
+\Exemple*|\StrRight{LaTeX}{-2}|
+\Exemple*|\StrRight{a bc def }{5}|
+
+\subsubsection{StrChar}
+
+\verb|\StrChar|\ARGU{string}\ARGU{number}\arguC{name}
+\smallskip
+
+Returns the character at the position \argu{number} in \argu{string}.\medskip
+
+\begin{Conditions}
+\item If \argu{string} is empty, no caracter is returned;
+\item If \argu{number}${}\leqslant0$ or if \argu{number}${}>{}$\argu{lengthString}, no character is returned.
+\end{Conditions}
+
+\Exemple|\StrChar{xstring}{4}|
+\Exemple*|\StrChar{xstring}{9}|
+\Exemple*|\StrChar{xstring}{-5}|
+\Exemple|\StrChar{a bc def }{6}|
+
+\subsubsection{StrMid}
+
+\verb|\StrMid|\ARGU{string}\ARGU{numberA}\ARGU{numberB}\arguC{name}
+\smallskip
+
+In \argu{string}, returns the substring between\footnote{In the broad sense, i.e. that the strings characters of the \guill{border} are returned.} the positions \argu{numberA} and \argu{numberB}.\medskip
+
+\begin{Conditions}
+\item If \argu{string} is empty, an empty string is returned;
+\item If \argu{numberA}${}>{}$\argu{numberB}, an empty string is returned;
+\item If \argu{numberA}${}<1$ and \argu{numberB}${}<1$ an empty string is returned;
+\item If \argu{numberA}${}>{}$\argu{lengthString} et \argu{numberB}${}>{}$\argu{lengthString}, an empty string is returned;
+\item If \argu{numberA}${}<1$, the macro behaves as if \argu{numberA}${}=1$;
+\item If \argu{numberB}${}>{}$\argu{lengthString}, the macro behaves as if \argu{numberB}${}={}$\argu{lengthString}.
+\end{Conditions}
+
+\Exemple|\StrMid{xstring}{2}{5}|
+\Exemple|\StrMid{xstring}{-4}{2}|
+\Exemple*|\StrMid{xstring}{5}{1}|
+\Exemple|\StrMid{xstring}{6}{15}|
+\Exemple|\StrMid{xstring}{3}{3}|
+\Exemple*|\StrMid{a bc def }{2}{7}|
+
+\subsection{Number results}
+\subsubsection{StrLen}
+
+\verb|\StrLen|\ARGU{string}\arguC{name}
+\smallskip
+
+Return the length of \argu{string}.
+
+\Exemple|\StrLen{xstring}|
+\Exemple|\StrLen{A}|
+\Exemple|\StrLen{a bc def }|
+
+\subsubsection{StrCount}
+
+\verb|\StrCount|\ARGU{string}\ARGU{stringA}\arguC{name}
+\smallskip
+
+Counts how many times \argu{stringA} is contained in \argu{string}.\par\medskip
+
+\begin{Conditions}
+\item If one at least of the arguments \argu{string} or \argu{stringA} is empty, the macro return 0.
+\end{Conditions}
+
+\Exemple|\StrCount{abracadabra}{a}|
+\Exemple|\StrCount{abracadabra}{bra}|
+\Exemple|\StrCount{abracadabra}{tic}|
+\Exemple|\StrCount{aaaaaa}{aa}|
+
+\subsubsection{StrPosition}
+
+\verb|\StrPosition|\arguC{number}\ARGU{string}\ARGU{stringA}\arguC{name}
+\smallskip
+
+The value of the optional argument \argu{number} is 1 by default.\par\smallskip
+
+In \argu{string}, returns the position of the \argu{number}\th{} occurrence of \argu{stringA}.\medskip
+
+\begin{Conditions}
+\item If \argu{number} is greater than the number of occurrences of \argu{stringA}, then the macro returns 0;
+\item If \argu{string} doesn't contain \argu{stringA}, then the macro returns 0.
+\end{Conditions}
+\medskip
+
+\Exemple|\StrPosition{xstring}{ring}|
+\Exemple|\StrPosition[4]{abracadabra}{a}|
+\Exemple|\StrPosition[2]{abracadabra}{bra}|
+\Exemple|\StrPosition[9]{abracadabra}{a}|
+\Exemple|\StrPosition{abracadabra}{z}|
+\Exemple|\StrPosition{a bc def }{d}|
+\Exemple|\StrPosition[3]{aaaaaa}{aa}|
+
+\section{Using the macros for programming purposes}
+\label{programmation}
+\subsection{Verbatimize to a control sequence}
+The macro \verb|\verbtocs| allow to read the content of a \guill{verb} argument containing special characters: \verb|&|, \verb|~|, \verb|\|, \verb|{|, \verb|}|, \verb|_|, \verb|#|, \verb|$|, \verb|^| et \verb|%|. The catcodes of \guill{normal} characters are left unchanged while special characters take a catcode 12. Then, these characters are assigned to a control sequence. The syntax is:\medskip
+
+\hfill\verb|\verbtocs|\ARGU{name}|\argu{characters}|\hfill{}
+\smallskip
+
+\argu{name} is the name of the control sequence receiving, with an \verb|\edef|, the \argu{characters}. Consequently, \argu{name} contains \texte{10,11,12}\voirdeftexte.\medskip
+
+By default, the character delimiting the verb content is \guill{|}. Obviously, this character cannot be both delimiting and being contained into what it delimits. If you need to verbatimize characters containing \guill{|}, you can change at any time the character delimiting the verb content with the macro:\par\medskip
+\hfill\verb|\setverbdelim|\ARGU{character}\hfill{}\smallskip
+
+Any \argu{character} with a catcode 11 or 12 can be used\footnote{Several characters can be used, but the syntax of \texttt{\textbackslash verbtocs} becomes less readable ! For this reason, a warning occurs when the argument of \texttt{\textbackslash setverbdelim} contains more than a single character.}. For example, after \verb|\setverbdelim{=}|, a verb argument look like this: \verb|=|\argu{characters}\verb|=|.\medskip
+
+About verb arguments, keep in mind that:
+\begin{itemize}
+ \item all the characters before |\argu{characters}| are ignored;
+ \item inside the verb argument, all the spaces are taken into account, even if they are consecutive.
+\end{itemize}
+\medskip
+
+Example:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\result} |a & b{ c% d$ e \f|
+ \result
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\result} |a & b{ c% d$ e \f|
+ \result
+\end{minipage}
+
+\subsection{Tokenization of a text to a control sequence}
+
+The reverse process of what has been seen above is to transform a \texte{10,11,12} into control sequences. This is done by the macro:\medskip
+
+\hfill\verb|\tokenize|\ARGU{name}\ARGU{control sequence}\hfill{}
+\smallskip
+
+\argu{control sequence} is fully expanded if \verb|\fullexpandarg| has been called (see page~\pageref{devarg}), and expanded 1 time if \verb|\normalexpandarg| has benn called. In both cases, the expansion must be \texte{10,11,12}. Then, this \texte{10,11,12} is converted into tokens and assigned with a \verb|\def| to the control sequence \argu{name}.\medskip
+
+Example:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\text}|\textbf{a} $\frac{1}{2}$|
+ text: \text
+ \tokenize{\result}{\text}
+ \par
+ result: \result
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \raggedright
+ \verbtocs{\text}
+ |\textbf{a} $\frac{1}{2}$|
+ text: \text
+ \tokenize{\result}{\text}
+ \par
+ result: \result
+\end{minipage}
+\medskip
+
+Obviously, the control sequence \verb|\result| can be called at the last line since the control sequences it contains are defined.
+
+\subsection{Expansion of a control sequence before verbatimize}
+\subsubsection{The scancs macro}
+It is possible to expand $n$ times a control sequence before converting this expansion into text. This is done by the macro:\medskip
+
+\hfill\verb|\scancs|\arguC{number}\ARGU{name}\ARGU{control sequence}\hfill{}
+\smallskip
+
+\argu{number}${}=1$ by default and represents the number of times \argu{control sequence} will be expanded before being converted in characters with catcodes 12 (or 10 for spaces). These characters are then assigned to \argu{name}.
+
+\subsubsection{Mind the catcodes !}
+Let's take a simple example where \argu{control sequence} expands to text:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\test{a b1 d}
+ \scancs{\result}{\test}
+ \resultat
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\test{a b1 d}
+ \scancs{\result}{\test}
+ \result
+\end{minipage}
+\medskip
+
+But mind the catcodes !
+
+In this example, \verb|\scancs{\result}{\test}| is not equivalent to \verb|\edef\result{\test}|.\medskip
+
+Indeed, with \verb|\scancs{\resultat}{\test}|, \verb|\result| contains \texte{10,12} and expands to:\par
+\hfill\verb|a|${}_{12}$\ \verb*| |${}_{10}$\ \verb|b|${}_{12}$\ \verb|1|${}_{12}$\ \verb*| |${}_{10}$\ \verb|d|${}_{12}$\hfill{}
+\medskip
+
+With \verb|\edef\resultat{\test}|, \verb|\resultat| contains \texte{10,11,12}, i.e. characters whose catcodes are 11 (the letters), 12 (the figure 1) and 10 (the spaces). It expands to:\par
+\hfill\verb|a|${}_{11}$\ \verb*| |${}_{10}$\ \verb|b|${}_{11}$\ \verb|1|${}_{12}$\ \verb*| |${}_{10}$\ \verb|d|${}_{11}$\hfill{}
+
+\subsubsection{Several expansions}
+If necessary, the number of expansions can be controled with the optional argument.
+In the following example, when \verb|\scancs| is called the first time, \verb|\c| is expanded 3 times and gives "\verb|1|${}_{12}$\ \verb*| |${}_{10}$\ \verb|z|${}_{11}$\ \verb*| |${}_{10}$\ \verb|3|${}_{12}$" which is converted into "\verb|1|${}_{12}$\ \verb*| |${}_{10}$\ \verb|z|${}_{12}$\ \verb*| |${}_{10}$\ \verb|3|${}_{12}$".\smallskip
+
+On the other hand, if after $n$ expansions, the result is a control sequence, this control sequence is transformed into characters with catcodes 12.
+In the example above, when \verb|\scancs| is called the second time, \verb|\scancs[2]{\resultat}{\c}| expands \verb|\c| 2 times: this gives the control sequence \fbox{\texttt{\textbackslash a}} which is converted into "\verb|\|${}_{12}$~\verb|a|${}_{12}$".\medskip
+
+This example show all the "depths" of expansion, from 3 to 0:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\a{1 z 3}
+ \def\b{\a}
+ \def\c{\b}
+ \scancs[3]{\result}{\c}
+ \result\par
+ \scancs[2]{\result}{\c}
+ \result\par
+ \scancs[1]{\result}{\c}
+ \result\par
+ \scancs[0]{\result}{\c}
+ \result
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\a{1 z 3}
+ \def\b{\a}
+ \def\c{\b}
+ \scancs[3]{\result}{\c}
+ \result\par
+ \scancs[2]{\result}{\c}
+ \result\par
+ \scancs[1]{\result}{\c}
+ \result\par
+ \scancs[0]{\result}{\c}
+ \result
+\end{minipage}
+\medskip
+
+Obviously, it is necessary to ensure that the expansion to the desired depth is possible.
+
+\subsubsection{Expansion of several control sequences}
+In normal use, the third argument \argu{control sequence} (or one of its expansions) must contain a single control sequence that will be expanded. If this third argument or one of its expansion contains several control sequences, compilation stops with an error message asking you to use the starred version. This starred version, more difficult to use allows to expand \argu{number} times \emph{all} the control sequences contained in the third argument. Let's see this with this example:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\a{LaTeX}
+ \def\b{is powerful}
+ \scancs*[1]{\result}{\a \b}
+ \result\par
+ \scancs*[2]{\result}{\a\space\b}
+ \result
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\a{LaTeX}
+ \def\b{is powerful}
+ \scancs*[1]{\result}{\a \b}
+ \result\par
+ \scancs*[2]{\result}{\a\space\b}
+ \result
+\end{minipage}
+\medskip
+
+First of all, a warning message has been sent to log: "if third argument or its expansion have braces or spaces, they will be removed when scanned! Use starred \verb|\scancs*| macro with care". Let's see what it means\ldots\medskip
+
+In the first result, a space is missing between the words \guill{LaTeX} and \guill{is}, though a space was present in the code between the 2 control sequences \verb|\a| and \verb|\b|. Indeed, \TeX{} ignores spaces that follow control sequences. Consequently, \verb|{\a \b}| is read as \verb|{\a\b}|, whatever be the number of spaces in the code between \verb|\a| and \verb|\b|. To obtain a space between \guill{LaTeX} and \guill{is}, we could have used the control sequence \verb|\space| whose expansion is a space, and write for the third argument: \verb|{\a\space\b}|. We could also have modified the defintion of \verb|\a| with a space after the word "LaTeX" like this: \verb|\def\a{LaTeX }|.\medskip
+
+However, it is necessary to be carfull when expanding control sequences more than one time: if a control sequence is expanded $n$ times and gives \texte{10,11,12}, the next expansion gobbles spaces. The second result shows that the second expansion gobbled all the spaces and consequently, \verb|\result| contains \guill{LaTeXispowerful}!\medskip
+
+Moreover, it's also the meaning of the warning message, if the $n$\th{} expansion of a control sequence contains braces, they will be gobbled, like spaces.\medskip
+
+Finaly, when using \verb|\scancs| a space is inserted after each control sequence. Indeed, \verb|\detokenize| (an $\varepsilon$-\TeX{} command) called by \verb|\scancs| inserts a space after each control sequence. There is no way to avoid this.
+
+\subsubsection{Examples}
+In the following example, control sequences are expanded 2 times: \verb|\d| gives \verb|\b|, and \verb|\b| gives\\\verb|\textbf{a}\textit{b}|. Notice that a space is inserted after each control sequence.\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\a{\textbf{a}\textit{b}}
+ \def\b{\a}
+ \def\c{\b}
+ \def\d{\c}
+ \scancs*[2]{\result}{\d\b}
+ \result
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\a{\textbf{a}\textit{b}}
+ \def\b{\a}
+ \def\c{\b}
+ \def\d{\c}
+ \scancs*[2]{\result}{\d\b}
+ \result
+\end{minipage}
+\medskip
+
+This is an example that shows the deletion of braces during the next expansion:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\a{1{2}}
+ \def\b{\a}
+ \scancs*[1]{\result}{\b{A}}
+ \result\par
+ \scancs*[2]{\result}{\b{A}}
+ \result\par
+ \scancs*[3]{\result}{\b{A}}
+ \result\par
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\a{1{2}}
+ \def\b{\a}
+ \scancs*[1]{\result}{\b{A}}
+ \result\par
+ \scancs*[2]{\result}{\b{A}}
+ \result\par
+ \scancs*[3]{\result}{\b{A}}
+ \result\par
+\end{minipage}
+\medskip
+
+Finaly, here is an example where we take advantage of the space inserted after each sequence control to find the $n$\th{} control sequence in the expansion of a control sequence.\medskip
+
+In the example above, we find the fourth control sequence in \verb|\myCS| whose expansion is:\par\medskip
+\hfill\verb|\a xy{3 2}\b7\c123 {m}\d{8}\e|\hfill{}
+\medskip
+
+Obviously, we expect: \verb|\d|\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\antislash}|\|
+ \newcommand\findcs[2]{%
+ \scancs[1]{\theCS}{#2}%
+ \tokenize{\theCS}{\theCS}%
+ \scancs[1]{\theCS}{\theCS}%
+ \StrBehind[#1]{\theCS}{\antislash}[\theCS]%
+ \StrBefore{\theCS}{ }[\theCS]%
+ \edef\theCS{\antislash\theCS}}
+ \verbtocs{\myCS}|\a xy{3 2}\b7\c123 {m}\d{8}\e|
+ % here, \myCS contains text
+ \findcs{4}{\myCS}
+ \theCS\par
+ \def\myCS{\a xy{3 2}\b7\c123 {m}\d{8}\e}
+ % here, \myCS contains control sequences
+ \findcs{4}{\myCS}
+ \theCS
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\antislash}|\|
+ \newcommand\findcs[2]{%
+ \scancs[1]{\theCS}{#2}%
+ \tokenize{\theCS}{\theCS}%
+ \scancs[1]{\theCS}{\theCS}%
+ \StrBehind[#1]{\theCS}{\antislash}[\theCS]%
+ \StrBefore{\theCS}{ }[\theCS]%
+ \edef\theCS{\antislash\theCS}}
+ \verbtocs{\myCS}|\a xy{3 2}\b7\c123 {m}\d{8}\e|
+ % here, \myCS contains text
+ \findcs{4}{\myCS}
+ \theCS\par
+ \def\myCS{\a xy{3 2}\b7\c123 {m}\d{8}\e}
+ % here, \myCS contains control sequences
+ \findcs{4}{\myCS}
+ \theCS
+\end{minipage}
+
+\subsection{Inside the definition of a macro}
+Some difficulties arise inside the definition of a macro, i.e. between braces following a \verb|\def\macro| or a\\\verb|\newcommand\macro|.\medskip
+
+It is forbidden to use the command \verb|\verb| inside the definition of a macro. For the same reasons:\par\medskip
+\hfill\textbf{Do not use \texttt{\textbackslash verbtocs} inside the definition of a macro}.\hfill{}\medskip
+
+But then, how to manipulate special characters and "verbatimize" inside the définition of macros ?\bigskip
+
+The \verb|\detokenize| primitive of $\varepsilon$-\TeX can be used but it has limitations:
+\begin{itemize}
+ \item braces must be balanced;
+ \item consecutive spaces make a single space;
+ \item the \verb|%| sign is not allowed;
+ \item a space is inserted after each control sequence;
+ \item \verb|#| signs become \verb|##|.
+\end{itemize}
+\medskip
+
+It is better to use \verb|\scancs| and define \emph{outside the definition of the macros} control sequences containing special characters with \verb|\verbtocs|. It is also possible to use \verb|\tokenize| to transform the final result (which is generaly \texte{10,11,12}) into control sequences. See example using these macros at the end of this manual, page~\pageref{exemples}.\medskip
+
+In the following teaching example\footnote{It is possible to make much more simple using \texttt{\textbackslash detokenize}. The macro becomes:\par\texttt{\textbackslash newcommand\textbackslash bracearg[1]\{\textbackslash detokenize\{\{\#1\}\}\}}}, the macro \verb|\bracearg| adds braces to its argument. To make this possible, 2 control sequences \verb|\Ob| and \verb|\Cb| containing "\verb|{|" and "\verb|}|" are defined outside the definition of \verb|\bracearg|, and expanded inside it:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\Ob}|{|
+ \verbtocs{\Cb}|}|
+ \newcommand\bracearg[1]{%
+ \def\text{#1}%
+ \scancs*{\result}{\Ob\text\Cb}%
+ \result}
+ \bracearg{xstring}\par
+ \bracearg{\a}
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\Ob}|{|
+ \verbtocs{\Cb}|}|
+ \newcommand\bracearg[1]{%
+ \def\text{#1}%
+ \scancs*{\result}{\Ob\text\Cb}%
+ \result}
+ \bracearg{xstring}\par
+ \bracearg{\a}
+\end{minipage}
+
+\subsection{Starred macros}
+As \verb|\scancs| returns \texte{10,12}\voirdeftexte, some unexpected results occur with the macros seen at chapter~\ref{listemacros} because they care the catcodes of the characters of their arguments.\medskip
+
+This is an example of such malfunctioning:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\mytext}|a b c|
+ \IfSubStr{\mytext}{b}{true}{false}
+ \par
+ \edef\onecs{x y z}
+ \scancs[1]\mycs\onecs
+ \IfSubStr{\mycs}{y}{true}{false}
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\mytext}|a b c|
+ \IfSubStr{\mytext}{b}{true}{false}
+ \par
+ \edef\onecs{x y z}
+ \scancs[1]\mycs\onecs
+ \IfSubStr{\mycs}{y}{true}{false}
+\end{minipage}
+\medskip
+
+The first test is "true" since catcodes of non special characters are left unchanged by \verb|\verbtocs|: indeed, \verb|\mytext| contains "\verb|a|${}_{11}$\ \verb*| |${}_{10}$\ \verb|b|${}_{11}$\ \verb*| |${}_{10}$\ \verb|c|${}_{11}$" which does contain the second argument "\verb|b|${}_{11}$".\medskip
+
+With the second test, since \verb|\scancs| returns \texte{10,12}, it is false. \verb|\mycs| contains "\verb|x|${}_{12}$\ \verb*| |${}_{10}$\ \verb|y|${}_{12}$\ \verb*| |${}_{10}$\ \verb|z|${}_{12}$" which does not contains the second argument ""\verb|y|${}_{11}$".\bigskip
+
+To avoid this annoyance due unmatching catcodes, it is possible to make macros of chapter~\ref{listemacros} compatible with \verb|\scancs|: they all have a starred version that converts textual arguments into \texte{10,12}, i.e. characters whose catcodes are 10 ou 12:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \edef\onecs{x y z}
+ \scancs[1]\mycs\onecs
+ \IfSubStr*{\mycs}{y}{true}{false}
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \edef\onecs{x y z}
+ \scancs[1]\mycs\onecs
+ \IfSubStr*{\mycs}{y}{true}{false}
+\end{minipage}
+
+\subsection{Examples}
+\label{exemples}
+Here are some very simple examples involving the macros of this package in programming purposes.
+
+\subsubsection{Example 1}
+We want to substitute the 2 first \verb|\textit| by \verb|\textbf| in the control sequence \verb|\myCS| winch contains \par\smallskip
+\hfill\verb|\textit{A}\textit{B}\textit{C}|\hfill{}
+\medskip
+
+We expect: \textbf{A}\textbf{B}\textit{C}\medskip
+
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\myCS{\textit{A}\textit{B}\textit{C}}
+ \scancs[1]{\text}{\myCS}
+ \StrSubstitute*[2]{\text}{textit}{textbf}[\text]
+ \tokenize{\myCS}{\text}
+ \myCS
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\myCS{\textit{A}\textit{B}\textit{C}}
+ \scancs[1]{\text}{\myCS}
+ \StrSubstitute*[2]{\text}{textit}{textbf}[\text]
+ \tokenize{\myCS}{\text}
+ \myCS
+\end{minipage}
+
+\subsubsection{Example 2}
+Let's try to write a macro \verb|\tofrac| that transforms an argument of this type \guill{a/b} into \guill{$\frac{a}{b}$}:\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\csfrac}|\frac|%
+ \verbtocs{\Ob}|{|%
+ \verbtocs{\Cb}|}|%
+ \newcommand\tofrac[1]{%
+ \scancs[0]{\myfrac}{#1}%
+ \StrBefore{\myfrac}{/}[\num]%
+ \StrBehind{\myfrac}{/}[\den]%
+ \tokenize\myfrac{\csfrac\Ob\num\Cb\Ob\den\Cb}%
+ $\myfrac$}
+ \tofrac{15/9}
+ \tofrac{u_{n+1}/u_n}
+ \tofrac{a^m/a^n}
+ \tofrac{x+\sqrt{x}/\sqrt{x^2+x+1}}
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\csfrac}|\frac|%
+ \verbtocs{\Ob}|{|%
+ \verbtocs{\Cb}|}|%
+ \newcommand\tofrac[1]{%
+ \scancs[0]{\myfrac}{#1}%
+ \StrBefore{\myfrac}{/}[\num]%
+ \StrBehind{\myfrac}{/}[\den]%
+ \tokenize\myfrac{\csfrac\Ob\num\Cb\Ob\den\Cb}%
+ $\myfrac$}
+ \tofrac{15/9}
+ \tofrac{u_{n+1}/u_n}
+ \tofrac{a^m/a^n}
+ \tofrac{x+\sqrt{x}/\sqrt{x^2+x+1}}
+\end{minipage}
+
+\subsubsection{Example 3}
+In a control sequence \verb|\text|, let's try to write in bold the first word that follows the word "new". In this example, \verb|\text| contains:\par\medskip
+\hfill\verb|Try the new package xstring !|\hfill{}\bigskip
+\setverbdelim{|}
+
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\text{Try the new package xstring !}
+ \def\word{new}
+ \StrBehind[1]{\text}{\word}[\name]
+ \IfBeginWith{\name}{ }%
+ {\StrGobbleLeft{\name}{1}[\name]}%
+ {}%
+ \StrBefore{\name}{ }[\name]
+ \verbtocs{\before}|\textbf{|
+ \verbtocs{\after}|}|
+ \StrSubstitute[1]%
+ {\text}{\name}{\before\name\after}[\text]
+ \tokenize{\text}{\text}
+ \text
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\text{Try the new package xstring !}
+ \def\word{new}
+ \StrBehind[1]{\text}{\word}[\name]
+ \IfBeginWith{\name}{ }%
+ {\StrGobbleLeft{\name}{1}[\name]}%
+ {}%
+ \StrBefore{\name}{ }[\name]
+ \verbtocs{\before}|\textbf{|
+ \verbtocs{\after}|}|
+ \StrSubstitute[1]%
+ {\text}{\name}{\before\name\after}[\text]
+ \tokenize{\text}{\text}
+ \text
+\end{minipage}
+
+\subsubsection{Example 4}
+A control sequence \verb|\myCS| défined with an \verb|\edef| contains control sequences with their possible arguments. How to reverse the order of the 2 first control sequences? In this example, \verb|\myCS| contains:\par\medskip
+\hfill\verb|\textbf{A}\textit{B}\texttt{C}|\hfill{}\bigskip
+
+We expect a final result containing \verb|\textit{B}\textbf{A}\texttt{C}| and displaying \textit{B}\textbf{A}\texttt{C}\medskip
+
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\myCS{\textbf{A}\textit{B}\texttt{C}}
+ \scancs[1]{\text}{\myCS}
+ \verbtocs{\antislash}|\|
+ \StrBefore[3]{\text}{\antislash}[\firsttwo]
+ \StrBehind{\text}{\firsttwo}[\others]
+ \StrBefore[2]{\firsttwo}{\antislash}[\avant]
+ \StrBehind{\firsttwo}{\avant}[\apres]%
+ \tokenize{\myCS}{\apres\avant\others}%
+ result: \myCS
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\myCS{\textbf{A}\textit{B}\texttt{C}}
+ \scancs[1]{\text}{\myCS}
+ \verbtocs{\antislash}|\|
+ \StrBefore[3]{\text}{\antislash}[\firsttwo]
+ \StrBehind{\text}{\firsttwo}[\others]
+ \StrBefore[2]{\firsttwo}{\antislash}[\avant]
+ \StrBehind{\firsttwo}{\avant}[\apres]%
+ \tokenize{\myCS}{\apres\avant\others}%
+ result: \myCS
+\end{minipage}
+
+\subsubsection{Example 5}
+A control sequence \verb|\myCS| defined with an \verb|\edef| contains control sequences and "groups" between braces. Let's try to find the $n$\th{} group, i.e. what is between the $n$\th{} pair of balanced braces. In this example, \verb|\myCS| contains:\par\medskip
+\hfill\verb|\a{1\b{2}}\c{3}\d{4\e{5}\f{6{7}}}|\hfill{}\medskip
+
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \newcount\occurr
+ \newcount\nbgroup
+ \newcommand\findgroup[2]{%
+ \scancs[1]{\text}{#2}%
+ \occurr=0
+ \nbgroup=0
+ \def\findthegroup{%
+ \StrBehind{\text}{\Obr}[\remain]%
+ \advance\occurr by 1% next "{"
+ \StrBefore[\the\occurr]{\remain}{\Cbr}[\group]%
+ \StrCount{\group}{\Obr}[\nbA]%
+ \StrCount{\group}{\Cbr}[\nbB]%
+ \ifnum\nbA=\nbB% balanced braces ?
+ \advance\nbgroup by 1
+ \ifnum\nbgroup<#1% not the good group ?
+ \StrBehind{\text}{\group}[\text]%
+ \occurr=0% initialise \text & \occur
+ \findthegroup% do it again
+ \fi
+ \else% unbalanced braces ?
+ % look for next "}"
+ \findthegroup
+ \fi}
+ \findthegroup
+ \group}
+
+ \verbtocs{\Obr}|{|
+ \verbtocs{\Cbr}|}|
+ \def\myCS{\a{1\b{2}}\c{3}\d{4\e{5}\f{6{7}}}}
+
+ group 1: \findgroup{1}{\myCS}\par
+ group 2: \findgroup{2}{\myCS}\par
+ group 3: \findgroup{3}{\myCS}
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \newcount\occurr
+ \newcount\nbgroup
+ \newcommand\findgroup[2]{%
+ \scancs[1]{\text}{#2}%
+ \occurr=0
+ \nbgroup=0
+ \def\findthegroup{%
+ \StrBehind{\text}{\Obr}[\remain]%
+ \advance\occurr by 1% next "{"
+ \StrBefore[\the\occurr]{\remain}{\Cbr}[\group]%
+ \StrCount{\group}{\Obr}[\nbA]%
+ \StrCount{\group}{\Cbr}[\nbB]%
+ \ifnum\nbA=\nbB% balanced braces ?
+ \advance\nbgroup by 1
+ \ifnum\nbgroup<#1% if it's not the sought group
+ \StrBehind{\text}{\group}[\text]%
+ \occurr=0% initialization of \text & \occur
+ \findthegroup% do it again
+ \fi
+ \else% unbalanced braces ?
+ % look for next "}"
+ \findthegroup
+ \fi}
+ \findthegroup
+ \group}
+
+ \verbtocs{\Obr}|{|
+ \verbtocs{\Cbr}|}|
+ \def\myCS{\a{1\b{2}}\c{3}\d{4\e{5}\f{6{7}}}}
+
+ groupe 1: \findgroup{1}{\myCS}\par
+ groupe 2: \findgroup{2}{\myCS}\par
+ groupe 3: \findgroup{3}{\myCS}
+\end{minipage}
+\medskip
+
+Notice that 2 counters, 2 tests and a double recursion are necessary to find the group: one of each to find what "\verb|}|" delimits the end of the current group, and the others to know the number of the group being read.\bigskip\bigskip
+
+\begin{center}
+$\star$
+
+$\star$\quad$\star$
+\end{center}
+\bigskip\bigskip
+
+That's all, I hope you will find this package useful !\par
+Please, send me an email if you find a bug or if you have any idea of improvement\ldots\medskip
+
+Christian Tellechea
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/xstring/xstring_doc_fr.pdf b/Master/texmf-dist/doc/latex/xstring/xstring_doc_fr.pdf
new file mode 100644
index 00000000000..6208955862e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xstring/xstring_doc_fr.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/xstring/xstring_doc_fr.tex b/Master/texmf-dist/doc/latex/xstring/xstring_doc_fr.tex
new file mode 100755
index 00000000000..90edd773ff5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xstring/xstring_doc_fr.tex
@@ -0,0 +1,1192 @@
+% This is xtring_doc_fr.tex, the manual of xstring (in french)
+% Christian Tellechea 2008
+%
+% email : unbonpetit@gmail.com
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+\documentclass[a4paper,10pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[dvips,colorlinks=true,hyperfootnotes=false,citecolor=black,filecolor=black,linkcolor=blue,urlcolor=blue,bookmarks=false,pdfauthor={Christian TELLECHEA},pdftitle={xstring},pdfsubject={package pour la manipulation de chaines de caractères},pdfkeywords={xstring,latex,string,chaine de caractères},pdfcreator={LaTeX}]{hyperref}
+\usepackage[a4paper,dvips,margin=2cm]{geometry}
+\usepackage{amssymb}
+\usepackage{moreverb}
+\usepackage{lmodern}
+\usepackage{eurosym}
+\usepackage{xstring}
+\usepackage[frenchb]{babel}
+\makeatletter
+
+\newcommand*\Exemple{\@ifstar{\def\frontiere{|}\@Ex}{\def\frontiere{}\@Ex}}
+% la macro de Ulrich Diez
+\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{\@ehc}%
+ \aftergroup\verb@balance@group%
+ \lowercase{%
+ \let ~\verb@egroup%
+ \def\@tempa##1~{\hbox to \Partage\linewidth{\hfil##1~}\quad\scantokens{\frontiere##1\frontiere}\par}}%
+ \@tempa}%
+\makeatother
+\newcommand\guill[1]{\og{}#1\fg{}}
+\newcommand\argu[1]{$\langle$\textit{#1}$\rangle$}
+\newcommand\ARGU[1]{\texttt{\{}\argu{#1}\texttt{\}}}
+\newcommand\arguC[1]{\texttt{[}\argu{#1}\texttt{]}}
+\newcommand\arguCC[2]{\texttt{[}\argu{#1}{,}\argu{#2}\texttt{]}}
+\newcommand\texte[1]{\texttt{texte}${}_{#1}$}
+\newcommand\voirdeftexte{~(voir \ref{deftexte})}
+\newenvironment{Conditions}[1][1cm]%
+{\begin{list}%
+ {$\vartriangleright$}%
+ {\setlength{\leftmargin}{#1}
+ \setlength{\itemsep}{0pt}
+ \setlength{\parsep}{0pt}
+ \setlength{\topsep}{2ptplus3ptminus2pt}
+ }}%
+{\end{list}}
+
+\begin{document}
+\gdef\Partage{0.7}
+\begin{titlepage}
+ \null\par\vfill
+ \begin{center}
+ \begin{minipage}{0.75\linewidth}
+ \begin{center}
+ \Huge\bfseries xstring\par\vspace{5pt}
+ \small v1.0\par\vspace{25pt}
+ \normalsize Manuel de l'utilisateur
+ \end{center}
+ \end{minipage}
+ \end{center}
+ \vspace{1cm}
+ \begin{center}
+ Christian {\sc Tellechea}\par\small
+ \href{mailto:unbonpetit@gmail.com}{\nolinkurl{unbonpetit@gmail.com}}\par\vspace{5pt}
+ 5 juillet 2008
+ \end{center}
+ \vfill\hrulefill
+ \begin{center}
+ \begin{minipage}{0.85\linewidth}
+ \noindent
+ \hfill\textbf{\textit{Résumé}}\hfill{}\medskip\par
+ Cette extension regroupe un ensemble de macros manipulant des chaînes de caractères :
+ \setlength{\parindent}{1.5em}
+ \begin{itemize}
+ \item[$\triangleright$] des tests :
+ \begin{itemize}
+ \item une chaîne en contient elle une autre au moins $n$ fois ?
+ \item une chaîne commence t-elle ou finit-elle par une autre ? etc.
+ \end{itemize}
+ \item[$\triangleright$] des extractions de chaînes :
+ \begin{itemize}
+ \item renvoi de ce qui se trouve avant (ou après) la $n$\ieme{} occurrence d'une sous-chaîne;
+ \item renvoi de ce qui se trouve entre les occurrences de 2 sous-chaînes;
+ \item sous-chaîne comprise entre 2 positions, etc.
+ \end{itemize}
+ \item[$\triangleright$] le remplacement de toutes ou des $n$ premières occurrences d'une sous-chaîne par une autre sous-chaîne;
+ \item[$\triangleright$] des calculs de nombres :
+ \begin{itemize}
+ \item longueur d'une chaîne;
+ \item position de la la $n$\ieme{} occurrence d'une sous-chaîne;
+ \item comptage du nombre d'occurrences d'une sous-chaîne dans une autre.
+ \end{itemize}
+ \end{itemize}
+ \medskip
+ D'autres commandes permettent de traiter les caractères spéciaux (\verb|&|, \verb|~|, \verb|\|, \verb|{|, \verb|}|, \verb|_|, \verb|#|, \verb|$|, \verb|^| et \verb|%|) de façon à les utiliser dans les arguments des macros de ce package, ce qui permet d'utiliser ces macros à fins de programmation.
+ \end{minipage}
+ \end{center}
+ \hrulefill\vfill{}
+\end{titlepage}
+\pagebreak
+\tableofcontents
+\pagebreak
+
+\section{Présentation}
+\subsection{Description}
+Cette extension regroupe des macros et des tests opérant sur des chaînes de caractères, un peu comme en disposent des langages dit \guill{évolués}. On y trouve les opérations habituelles sur les chaînes de caractères, comme par exemple : test si une chaîne en contient une autre, commence ou finit par une autre, extractions de sous-chaînes ou de caractères, calculs de position d'une sous-chaîne, calculs du nombre d'occurrences, etc.\medskip
+
+Certes d'autres packages existent (par exemple \href{http://www.ctan.org/tex-archive/macros/latex/contrib/substr/}{\nolinkurl{substr}} et \href{http://www.ctan.org/tex-archive/macros/latex/contrib/stringstrings/}{\nolinkurl{stringstrings}}), mais outre des différences notables quant aux fonctionnalités, ils ne prennent pas en charge les occurrences des sous-chaînes et me semblent soit trop limités, soit trop difficiles à utiliser pour la programmation.
+
+\subsection{Motivation}
+J'ai été conduit à écrire ce type de macros car je n'ai jamais vraiment trouvé de d'outils sous \LaTeX{} adaptés à mes besoins concernant le traitement de chaînes de caractères. Alors, au fil des derniers mois, et avec l'aide de contributeurs\footnote{Je remercie chaleureusement Manuel alias \guill{\nolinkurl{mpg}} pour son aide précieuse, sa compétence et sa disponibilité.} de \nolinkurl{fr.comp.text.tex}, j'ai écrit quelques macros qui me servaient ponctuellement ou régulièrement. Leur nombre s'étant accru, et celles-ci devenant un peu trop dispersées dans les répertoires de mon ordinateur, je les ai regroupées dans ce package.
+
+Ainsi, le fait de donner corps à un ensemble cohérent de macros force à davantage de rigueur et induit naturellement de nécessaires améliorations, ce qui a pris la majeure partie du temps que j'ai consacré à ce package. Pour harmoniser le tout, mais à contre-c\oe{}ur, j'ai fini par choisir des noms de macros à consonances anglo-saxonnes.\medskip
+
+Ensuite, et ça a été ma principale motivation puisque j'ai découvert \LaTeX{} il y a moins d'un an, l'écriture de xstring qui est mon premier package m'a surtout permis de beaucoup progresser en programmation pure, et aborder des méthodes propres à la programmation sous \TeX.
+
+\subsection{Fonctionnement}
+\label{deftexte}
+Dans la suite, on écrira \guill{\texte{10,11,12}} une suite de caractères dont les catcodes sont 10, 11 ou 12.
+\subsubsection{Développement des arguments}
+\label{devarg}
+Tous les arguments des macros\footnote{À l'exeption des 2 derniers arguments des macros tests qui contiennent des séquences de contrôle à exécuter selon le résultat du test, ainsi qu'à l'exception de l'argument optionnel venant en dernière position.} manipulant des chaînes de caractères sont susceptibles de donner, à une certaine profondeur de développement du \texte{10,11,12}. Ainsi, \emph{par défaut}, pour éviter des chaines d'\verb|\expandafter| et faciliter l'usage des macros de ce package, tous les arguments sont développés au maximum avant d'être pris en compte par la macro appelée : pour cela, la commande \verb|\fullexpandarg| est appelée par défaut.\bigskip
+
+Par exemple, si \verb|\macro| est une macro de ce package nécessitant un argument texte et un argument nombre obligatoires, les constructions suivantes sont équivalentes :\medskip
+
+\begin{minipage}[t]{0.35\linewidth}
+ Construction avec \verb|\fullexpandarg|\par\hrulefill\par
+ \verb|\def\aa{du texte}|\par
+ \verb|\def\nn{2}|\par
+ \verb|\macro{\aa}{\nn}|
+\end{minipage}
+\hfill
+\begin{minipage}[t]{0.6\linewidth}
+ Construction habituelle sous \LaTeX{} ou avec \verb|\normalexpandarg|\par\hrulefill\par
+ \verb|\def\aa{du texte}|\par
+ \verb|\def\nn{2}|\par
+ \verb|\expandafter\expandafter\expandafter\macro|\par
+ \verb| \expandafter\expandafter\expandafter|\par
+ \verb| {\expandafter\aa\expandafter}\expandafter{\nn}|
+\end{minipage}\hfill{}\medskip
+
+La construction de gauche permet de s'affranchir de l'ordre de développement des arguments et épargne à l'utilisateur des chaînes d'\verb|\expandafter|. En revanche, les arguments doivent être purement développables, et donner à leur développement maximum du \texte{10,11,12} contenant ce qui est attendu (nombre ou chaîne de caractères).\medskip
+
+On peut cependant revenir à tout moment à l'ordre habituel de développement avec la commande\\\verb|\normalexpandarg|, et utiliser quand on le souhaite \verb|\fullexpandarg| qui est appelée par défaut pour basculer à nouveau vers le développement maximum des arguments.
+
+\subsubsection{Arguments textuels}
+Les macros de packages manipulant des chaînes de caractères, elles nécessitent un ou plusieurs arguments contenant du \texte{10,11,12}\voirdeftexte{}, en respectant la classique syntaxe entre accolades \verb|{|\texte{10,11,12}\verb|}| ou entre crochet pour les arguments optionnels \verb|[|\texte{10,11,12}\verb|]|.\medskip
+
+Il convient de respecter les règles suivantes pour le développement des arguments textuels :
+\begin{itemize}
+ \item ils peuvent contenir des lettres (majuscules ou minuscules, accentuées\footnote{Pour pouvoir utiliser des lettres accentuées de façon fiable, il est nécessaire de charger le packages \texttt{\textbackslash fontenc} avec l'option \texttt{[T1]}, ainsi que \texttt{\textbackslash inputenc} avec l'option correspondant au codage du fichier tex} ou non), des chiffres et des espaces, ainsi que tout caractère de catcode 10, 11 ou 12 (signes de ponctuation, signes opératoires mathématiques, parenthèses, crochets, etc). Le signe \officialeuro, par contre, génèrera des erreurs.
+ \item les espaces sont gérés et comptabilisés comme des caractères à part entière, à la condition qu'il ne se suivent pas, auquel cas, la règle \LaTeX{}ienne prévaut et plusieurs espaces consécutifs n'en font qu'un seul;
+ \item aucun caractère spécial n'est accepté, c'est-à-dire que les 10 caractères suivants sont strictement interdits : \verb|&|, \verb|~|, \verb|\|, \verb|{|, \verb|}|, \verb|_|, \verb|#|, \verb|$|, \verb|^| et \verb|%|.
+\end{itemize}\medskip
+
+Pour contourner certaines de ces règles et aller plus loin dans les possibilités des macros pour les utiliser à des fins de programmation, il existe des macros spéciales qui permettent d'inclure dans des arguments textuels n'importe quel caractère spécial, c'est-à-dire un caractère dont le catcode est différent de 10, 11 ou 12, ainsi que des séquences de contrôle en contenant. Voir la description détaillée de ce mode de fonctionnement au chapitre \ref{programmation}, page~\pageref{programmation}.
+
+\subsubsection{Développement des macros, argument optionnel}
+Les macros de ce package ne sont pas purement développables et ne peuvent donc pas être mises dans l'argument d'un \verb|\edef|. Par conséquent, certaines constructions ne sont pas acceptées et conduisent à des erreurs lors de la compilation. Si par exemple, \verb|\commande{argument}| est une macro de ce package avec son argument, supposée renvoyer une chaîne de caractères, alors les constructions suivantes ne sont pas permises :\smallskip
+
+\hspace{0.2\linewidth}\verb|\edef\Resultat{\commande{argument}}|\par
+\qquad pas plus que\par
+\hspace{0.2\linewidth}\verb|\commandeA{\commandeB{\commandeC{argument}}}|\smallskip
+
+C'est pour cela que les macros renvoyant un résultat, c'est-à-dire toutes sauf les tests, sont dotées d'un argument optionnel venant en dernière position. Cet argument prend la forme de \arguC{nom}, où \argu{nom} est le nom d'une séquence de contrôle qui recevra (l'assignation se fait avec un \verb|\edef|) le résultat de la macro, ce qui fait que \verb|\|\argu{nom} est purement développable et peut donc se trouver dans l'argument d'un \verb|\edef|. Dans le cas de la présence d'un argument optionnel en dernière position, aucun affichage n'aura lieu. Cet argument optionnel, évidemment, n'est pas développé contrairement aux autres arguments. Il permet ainsi contourner les limitations évoquées dans les exemples ci dessus.\medskip
+
+Ainsi cette construction non permise :\par
+\hspace{0.2\linewidth}\verb|\edef\Resultat{\commande{arguments}}|\par
+\qquad est équivalente à\par
+\hspace{0.2\linewidth}\verb|\commande{argument}[\Resultat]|\medskip
+
+Et cet autre construction non permise :\par
+\hspace{0.2\linewidth}\verb|\commandeA{\commandeB{\commandeC{arguments}}}|\par
+\qquad se comporte de même que\par
+\hspace{0.2\linewidth}\verb|\commandeC{arguments}[\MaChaine]|\par
+\hspace{0.2\linewidth}\verb|\commandeB{\MaChaine}[\MaChaine]|\par
+\hspace{0.2\linewidth}\verb|\commandeA{\MaChaine}|\par
+
+\section{Les macros}
+\label{listemacros}
+\subsection{Présentation des macros}
+Dans ce chapitre, la totalité des macros est présentée selon ce plan :\smallskip
+
+\begin{itemize}
+ \item la syntaxe ainsi que la valeur d'éventuels arguments optionnels;
+ \item une brève description du fonctionnement;
+ \item le fonctionnement sous certaines conditions particulières. Pour chaque conditions envisagée, le fonctionnement décrit est prioritaire sur celui (ceux) se trouvant au dessous de lui;
+ \item enfin, quelques exemples sont donnés. J'ai essayé de les trouver les plus facilement compréhensibles et les plus représentatifs des situations rencontrées dans une utilisation normale\footnote{Pour une collection plus importante d'exemples, on peut aussi consulter le fichier de test.}. Si un doute est possible quant à la présence d'espaces dans le résultat, celui-ci sera délimité par des \guill{|}, étant entendu qu'une chaîne vide est représentée par \guill{||}.
+\end{itemize}\smallskip
+
+\subsection{Les tests}
+\subsubsection{IfSubStr}
+\verb|\IfSubStr|\arguC{nombre}\ARGU{chaine}\ARGU{chaineA}\ARGU{vrai}\ARGU{faux}
+\smallskip
+
+L'argument optionnel \argu{nombre} vaut 1 par défaut.\par
+\smallskip
+
+Teste si \argu{chaine} contient au moins \argu{nombre} fois \argu{chaineA} et exécute \argu{vrai} dans l'affirmative, et \argu{faux} dans le cas contraire.\medskip
+
+\begin{Conditions}
+ \item Si \argu{nombre}${}\leqslant0$, exécute \argu{faux};
+ \item Si \argu{chaine} ou \argu{chaineA} est vide, exécute \argu{faux}.
+\end{Conditions}
+
+\Exemple|\IfSubStr{xstring}{tri}{vrai}{faux}|
+\Exemple|\IfSubStr{xstring}{a}{vrai}{faux}|
+\Exemple|\IfSubStr{a bc def }{c d}{vrai}{faux}|
+\Exemple|\IfSubStr{a bc def }{cd}{vrai}{faux}|
+\Exemple|\IfSubStr[2]{1a2a3a}{a}{vrai}{faux}|
+\Exemple|\IfSubStr[3]{1a2a3a}{a}{vrai}{faux}|
+\Exemple|\IfSubStr[4]{1a2a3a}{a}{vrai}{faux}|
+
+\subsubsection{IfSubStrBefore}
+\verb|\IfSubStrBefore|\arguCC{nombre1}{nombre2}\ARGU{chaine}\ARGU{chaineA}\ARGU{chaineB}\ARGU{vrai}\ARGU{faux}
+\smallskip
+
+Les arguments optionnels \argu{nombre1} et \argu{nombre2} valent 1 par défaut.\par\smallskip
+
+Dans \argu{chaine}, la macro teste si l'occurrence \no\argu{nombre1} de \argu{chaineA} se trouve à gauche de l'occurrence \no\argu{nombre2} de \argu{chaineB}. Exécute \argu{vrai} dans l'affirmative, et \argu{faux} dans le cas contraire.\medskip
+
+\begin{Conditions}
+ \item Si l'une des occurrences n'est pas trouvée, exécute \argu{faux};
+ \item Si l'un des arguments \argu{chaine}, \argu{chaineA} ou \argu{chaineB} est vide, exécute \argu{faux};
+ \item Si l'un au moins des deux arguments optionnels est négatif ou nul, exécute \argu{faux}.
+\end{Conditions}
+
+\Exemple|\IfSubStrBefore{xstring}{st}{in}{vrai}{faux}|
+\Exemple|\IfSubStrBefore{xstring}{ri}{s}{vrai}{faux}|
+\Exemple|\IfSubStrBefore{LaTeX}{LaT}{TeX}{vrai}{faux}|
+\Exemple|\IfSubStrBefore{a bc def }{ b}{ef}{vrai}{faux}|
+\Exemple|\IfSubStrBefore{a bc def }{ab}{ef}{vrai}{faux}|
+\Exemple|\IfSubStrBefore[2,1]{b1b2b3}{b}{2}{vrai}{faux}|
+\Exemple|\IfSubStrBefore[3,1]{b1b2b3}{b}{2}{vrai}{faux}|
+\Exemple|\IfSubStrBefore[2,2]{baobab}{a}{b}{vrai}{faux}|
+\Exemple|\IfSubStrBefore[2,3]{baobab}{a}{b}{vrai}{faux}|
+
+\subsubsection{IfSubStrBehind}
+\verb|\IfSubStrBehind|\arguCC{nombre1}{nombre2}\ARGU{chaine}\ARGU{chaineA}\ARGU{chaineB}\ARGU{vrai}\ARGU{faux}
+\smallskip
+
+Les arguments optionnels \argu{nombre1} et \argu{nombre2} valent 1 par défaut.\par\smallskip
+
+Dans \argu{chaine}, la macro teste si l'occurrence \no\argu{nombre1} de \argu{chaineA} se trouve après l'occurrence \\\no\argu{nombre2} de \argu{chaineB}. Exécute \argu{vrai} dans l'affirmative, et \argu{faux} dans le cas contraire.\medskip
+
+\begin{Conditions}
+ \item Si l'une des occurrences n'est pas trouvée, exécute \argu{faux};
+ \item Si l'un des arguments \argu{chaine}, \argu{chaineA} ou \argu{chaineB} est vide, exécute \argu{faux};
+ \item Si l'un au moins des deux arguments optionnels est négatif ou nul, exécute \argu{faux}.
+\end{Conditions}
+
+\Exemple|\IfSubStrBehind{xstring}{ri}{xs}{vrai}{faux}|
+\Exemple|\IfSubStrBehind{xstring}{s}{i}{vrai}{faux}|
+\Exemple|\IfSubStrBehind{LaTeX}{TeX}{LaT}{vrai}{faux}|
+\Exemple|\IfSubStrBehind{a bc def }{ d}{a}{vrai}{faux}|
+\Exemple|\IfSubStrBehind{a bc def }{cd}{a b}{vrai}{faux}|
+\Exemple|\IfSubStrBehind[2,1]{b1b2b3}{b}{2}{vrai}{faux}|
+\Exemple|\IfSubStrBehind[3,1]{b1b2b3}{b}{2}{vrai}{faux}|
+\Exemple|\IfSubStrBehind[2,2]{baobab}{b}{a}{vrai}{faux}|
+\Exemple|\IfSubStrBehind[2,3]{baobab}{b}{a}{vrai}{faux}|
+
+\subsubsection{IfBeginWith}
+
+\verb|\IfBeginWith|\ARGU{chaine}\ARGU{chaineA}\ARGU{vrai}\ARGU{faux}
+\smallskip
+
+Teste si \argu{chaine} commence par \argu{chaineA}, et exécute \argu{vrai} dans l'affirmative, et \argu{faux} dans le cas contraire.\medskip
+
+\begin{Conditions}
+\item Si \argu{chaine} ou \argu{chaineA} est vide, exécute \argu{faux}.
+\end{Conditions}
+
+\Exemple|\IfBeginWith{xstring}{xst}{vrai}{faux}|
+\Exemple|\IfBeginWith{LaTeX}{a}{vrai}{faux}|
+\Exemple|\IfBeginWith{a bc def }{a b}{vrai}{faux}|
+\Exemple|\IfBeginWith{a bc def }{ab}{vrai}{faux}|
+
+\subsubsection{IfEndWith}
+
+\verb|\IfEndWith|\ARGU{chaine}\ARGU{chaineA}\ARGU{vrai}\ARGU{faux}
+\smallskip
+
+Teste si \argu{chaine} se termine par \argu{chaineA}, et exécute \argu{vrai} dans l'affirmative, et \argu{faux} dans le cas contraire.\medskip
+
+\begin{Conditions}
+ \item Si \argu{chaine} ou \argu{chaineA} est vide, exécute \argu{faux}.
+\end{Conditions}
+
+\Exemple|\IfEndWith{xstring}{ring}{vrai}{faux}|
+\Exemple|\IfEndWith{LaTeX}{a}{vrai}{faux}|
+\Exemple|\IfEndWith{a bc def }{ef }{vrai}{faux}|
+\Exemple|\IfEndWith{a bc def }{ef}{vrai}{faux}|
+
+\subsection{Les macros renvoyant une chaîne}
+\subsubsection{StrBefore}
+\verb|\StrBefore|\arguC{nombre}\ARGU{chaine}\ARGU{chaineA}\arguC{nom}
+\smallskip
+
+L'argument optionnel \argu{nombre} vaut 1 par défaut.\par\smallskip
+
+Dans \argu{chaine}, renvoie ce qui se trouve avant l'occurrence \no\argu{nombre} de \argu{chaineA}.\medskip
+
+\begin{Conditions}
+ \item Si \argu{chaine} ou \argu{chaineA} est vide, une chaîne vide est renvoyée;
+ \item Si \argu{nombre}${}<1$ alors, la macro se comporte comme si \argu{nombre}${}=1$;
+ \item Si l'occurrence n'est pas trouvée, une chaîne vide est renvoyée.
+\end{Conditions}
+
+\Exemple*|\StrBefore{xstring}{tri}|
+\Exemple*|\StrBefore{LaTeX}{e}|
+\Exemple*|\StrBefore{LaTeX}{p}|
+\Exemple*|\StrBefore{LaTeX}{L}|
+\Exemple*|\StrBefore{a bc def }{def}|
+\Exemple*|\StrBefore{a bc def }{cd}|
+\Exemple*|\StrBefore[1]{1b2b3}{b}|
+\Exemple*|\StrBefore[2]{1b2b3}{b}|
+
+\subsubsection{StrBehind}
+\verb|\StrBehind|\arguC{nombre}\ARGU{chaine}\ARGU{chaineA}\arguC{nom}
+\smallskip
+
+L'argument optionnel \argu{nombre} vaut 1 par défaut.\par\smallskip
+
+Dans \argu{chaine}, renvoie ce qui se trouve après l'occurrence \no\argu{nombre} de \argu{chaineA}.\medskip
+
+\begin{Conditions}
+ \item Si \argu{chaine} ou \argu{chaineA} est vide, une chaîne vide est renvoyée;
+ \item Si \argu{nombre}${}<1$ alors, la macro se comporte comme si \argu{nombre}${}=1$;
+ \item Si l'occurrence n'est pas trouvée, une chaîne vide est renvoyée.
+\end{Conditions}
+
+\Exemple*|\StrBehind{xstring}{tri}|
+\Exemple*|\StrBehind{LaTeX}{e}|
+\Exemple*|\StrBehind{LaTeX}{p}|
+\Exemple*|\StrBehind{LaTeX}{X}|
+\Exemple*|\StrBehind{a bc def }{bc}|
+\Exemple*|\StrBehind{a bc def }{cd}|
+\Exemple*|\StrBehind[1]{1b2b3}{b}|
+\Exemple*|\StrBehind[2]{1b2b3}{b}|
+\Exemple*|\StrBehind[3]{1b2b3}{b}|
+
+\subsubsection{StrBetween}
+\verb|\StrBetween|\arguCC{nombre1}{nombre2}\ARGU{chaine}\ARGU{chaineA}\ARGU{chaineB}\arguC{nom}
+\smallskip
+
+Les arguments optionnels \argu{nombre1} et \argu{nombre2} valent 1 par défaut.\par\smallskip
+
+Dans \argu{chaine}, renvoie ce qui se trouve entre\footnote{Au sens strict, c'est-à-dire \emph{sans} les chaînes frontière} les occurrences \no\argu{nombre1} de \argu{chaineA} et \no \argu{nombre2} de \argu{chaineB}.
+\medskip
+
+\begin{Conditions}
+ \item Si les occurrences ne sont pas dans l'ordre (\argu{chaineA} \emph{puis} \argu{chaineB}) dans \argu{chaine}, une chaîne vide est renvoyée;
+ \item Si l'une des 2 occurrences n'existe pas dans \argu{chaine}, une chaîne vide est renvoyée;
+ \item Si l'un des arguments optionnels \argu{nombre1} ou \argu{nombre2} est négatif ou nul, une chaîne vide est renvoyée.
+\end{Conditions}
+
+\Exemple*|\StrBetween{xstring}{xs}{ng}|
+\Exemple*|\StrBetween{xstring}{i}{n}|
+\Exemple*|\StrBetween{xstring}{a}{tring}|
+\Exemple*|\StrBetween{a bc def }{a}{d}|
+\Exemple*|\StrBetween{a bc def }{a }{f}|
+\Exemple*|\StrBetween{a1b1a2b2a3b3}{a}{b}|
+\Exemple*|\StrBetween[2,3]{a1b1a2b2a3b3}{a}{b}|
+\Exemple*|\StrBetween[1,3]{a1b1a2b2a3b3}{a}{b}|
+\Exemple*|\StrBetween[3,1]{a1b1a2b2a3b3}{a}{b}|
+\Exemple*|\StrBetween[3,2]{abracadabra}{a}{bra}|
+
+\subsubsection{StrSubstitute}
+\verb|\StrSubstitute|\arguC{nombre}\ARGU{chaine}\ARGU{chaineA}\ARGU{chaineB}\arguC{nom}
+\smallskip
+
+L'argument optionnel \argu{nombre} vaut 0 par défaut.\par\smallskip
+
+Dans \argu{chaine}, la macro remplace les \argu{nombre} premières occurrences de \argu{chaineA} par \argu{chaineB}, sauf si \argu{nombre}${}=0$ auquel cas, \emph{toutes} les occurrences sont remplacées.
+
+\begin{Conditions}
+ \item Si \argu{chaine} est vide, une chaîne vide est renvoyée;
+ \item Si \argu{chaineA} est vide ou n'existe pas dans \argu{chaine}, la macro est sans effet;
+ \item Si \argu{nombre} est supérieur au nombre d'occurrences de \argu{chaineA}, alors toutes les occurrences sont remplacées;
+ \item Si \argu{nombre}${}<0$ alors la macro se comporte comme si \argu{nombre}${}=0$;
+ \item Si \argu{chaineB} est vide, alors les occurrences de \argu{chaineA}, si elles existent, sont supprimées.
+\end{Conditions}
+
+\Exemple|\StrSubstitute{xstring}{i}{a}|
+\Exemple|\StrSubstitute{abracadabra}{a}{o}|
+\Exemple|\StrSubstitute{abracadabra}{br}{TeX}|
+\Exemple|\StrSubstitute{LaTeX}{m}{n}|
+\Exemple|\StrSubstitute{a bc def }{ }{M}|
+\Exemple|\StrSubstitute{a bc def }{ab}{AB}|
+\Exemple|\StrSubstitute[1]{a1a2a3}{a}{B}|
+\Exemple|\StrSubstitute[2]{a1a2a3}{a}{B}|
+\Exemple|\StrSubstitute[3]{a1a2a3}{a}{B}|
+\Exemple|\StrSubstitute[4]{a1a2a3}{a}{B}|
+
+\subsubsection{StrDel}
+\verb|\StrDel|\arguC{nombre}\ARGU{chaine}\ARGU{chaineA}\arguC{nom}
+\smallskip
+
+L'argument optionnel \argu{nombre} vaut 0 par défaut.\par\smallskip
+
+Supprime les \argu{nombre} premières occurrences de \argu{chaineA} dans \argu{chaine}, sauf si \argu{nombre}${}=0$ auquel cas, \emph{toutes} les occurrences sont supprimées.\medskip
+
+\begin{Conditions}
+ \item Si \argu{chaine} est vide, une chaîne vide est renvoyée;
+ \item Si \argu{chaineA} est vide ou n'existe pas dans \argu{chaine}, la macro est sans effet;
+ \item Si \argu{nombre} est supérieur au nombre d'occurrences de \argu{chaineA}, alors toutes les occurrences sont supprimées;
+ \item Si \argu{nombre}${}<0$ alors la macro se comporte comme si \argu{nombre}${}=0$;
+\end{Conditions}
+
+\Exemple|\StrDel{abracadabra}{a}|
+\Exemple|\StrDel[1]{abracadabra}{a}|
+\Exemple|\StrDel[4]{abracadabra}{a}|
+\Exemple|\StrDel[9]{abracadabra}{a}|
+\Exemple|\StrDel{a bc def }{ }|
+\Exemple*|\StrDel{a bc def }{def}|
+
+
+\subsubsection{StrGobbleLeft}
+\verb|\StrGobbleLeft|\ARGU{chaine}\ARGU{nombre}\arguC{nom}
+\smallskip
+
+Dans \argu{chaine}, enlève les \argu{nombre} premiers caractères de gauche.\medskip
+
+\begin{Conditions}
+ \item Si \argu{chaine} est vide, renvoie une chaîne vide;
+ \item Si \argu{nombre}${}\leqslant0$, aucun caractère n'est supprimé.
+ \item Si \argu{nombre}${}\geqslant{}$\argu{longueurChaine}, tous les caractères sont supprimés.
+\end{Conditions}
+
+\Exemple*|\StrGobbleLeft{xstring}{2}|
+\Exemple*|\StrGobbleLeft{xstring}{9}|
+\Exemple*|\StrGobbleLeft{LaTeX}{4}|
+\Exemple*|\StrGobbleLeft{LaTeX}{-2}|
+\Exemple*|\StrGobbleLeft{a bc def }{4}|
+
+\subsubsection{StrLeft}
+\verb|\StrLeft|\ARGU{chaine}\ARGU{nombre}\arguC{nom}
+\smallskip
+
+Dans \argu{chaine}, renvoie la sous-chaîne de gauche de longueur \argu{nombre}.\medskip
+
+\begin{Conditions}
+ \item Si \argu{chaine} est vide, renvoie une chaîne vide;
+ \item Si \argu{nombre}${}\leqslant0$, aucun caractère n'est retourné.
+ \item Si \argu{nombre}${}\geqslant{}$\argu{longueurChaine}, tous les caractères sont retournés.
+\end{Conditions}
+
+\Exemple*|\StrLeft{xstring}{2}|
+\Exemple*|\StrLeft{xstring}{9}|
+\Exemple*|\StrLeft{LaTeX}{4}|
+\Exemple*|\StrLeft{LaTeX}{-2}|
+\Exemple*|\StrLeft{a bc def }{5}|
+
+\subsubsection{StrGobbleRight}
+\verb|\StrGobbleRight|\ARGU{chaine}\ARGU{nombre}\arguC{nom}
+\smallskip
+
+Agit comme \verb|\StrGobbleLeft|, mais enlève les caractères à droite de \argu{chaine}.
+
+\Exemple*|\StrGobbleRight{xstring}{2}|
+\Exemple*|\StrGobbleRight{xstring}{9}|
+\Exemple*|\StrGobbleRight{LaTeX}{4}|
+\Exemple*|\StrGobbleRight{LaTeX}{-2}|
+\Exemple*|\StrGobbleRight{a bc def }{4}|
+
+\subsubsection{StrRight}
+\verb|\StrRight|\ARGU{chaine}\ARGU{nombre}\arguC{nom}
+\smallskip
+
+Agit comme \verb|\StrLeft|, mais renvoie les caractères à la droite de \argu{chaine}.
+
+\Exemple*|\StrRight{xstring}{2}|
+\Exemple*|\StrRight{xstring}{9}|
+\Exemple*|\StrRight{LaTeX}{4}|
+\Exemple*|\StrRight{LaTeX}{-2}|
+\Exemple*|\StrRight{a bc def }{5}|
+
+\subsubsection{StrChar}
+\verb|\StrChar|\ARGU{chaine}\ARGU{nombre}\arguC{nom}
+\smallskip
+
+Renvoie le caractère à la position \argu{nombre} dans la chaîne \argu{chaine}.\medskip
+
+\begin{Conditions}
+ \item Si \argu{chaine} est vide, aucun caractère n'est renvoyé;
+ \item Si \argu{nombre}${}\leqslant0$ ou si \argu{nombre}${}>{}$\argu{longueurChaine}, aucun caractère n'est renvoyé.
+\end{Conditions}
+
+\Exemple|\StrChar{xstring}{4}|
+\Exemple*|\StrChar{xstring}{9}|
+\Exemple*|\StrChar{xstring}{-5}|
+\Exemple|\StrChar{a bc def }{6}|
+
+\subsubsection{StrMid}
+\verb|\StrMid|\ARGU{chaine}\ARGU{nombreA}\ARGU{nombreB}\arguC{nom}
+\smallskip
+
+Dans \argu{chaine}, renvoie la sous chaîne se trouvant entre\footnote{Au sens large, c'est-à-dire que les chaînes \guill{frontière} sont renvoyés.} les positions \argu{nombreA} et \argu{nombreB}.\medskip
+
+\begin{Conditions}
+ \item Si \argu{chaine} est vide, une chaîne vide est renvoyée;
+ \item Si \argu{nombreA}${}>{}$\argu{nombreB}, alors rien n'est renvoyé;
+ \item Si \argu{nombreA}${}<1$ et \argu{nombreB}${}<1$ alors rien n'est renvoyé;
+ \item Si \argu{nombreA}${}>{}$\argu{longueurChaine} et \argu{nombreB}${}>{}$\argu{longueurChaine}, alors rien n'est renvoyé;
+ \item Si \argu{nombreA}${}<1$, alors la macro se comporte comme si \argu{nombreA}${}=1$;
+ \item Si \argu{nombreB}${}>{}$\argu{longueurChaine}, alors la macro se comporte comme si \argu{nombreB}${}={}$\argu{longueurChaine}.
+\end{Conditions}
+
+\Exemple|\StrMid{xstring}{2}{5}|
+\Exemple|\StrMid{xstring}{-4}{2}|
+\Exemple*|\StrMid{xstring}{5}{1}|
+\Exemple|\StrMid{xstring}{6}{15}|
+\Exemple|\StrMid{xstring}{3}{3}|
+\Exemple*|\StrMid{a bc def }{2}{7}|
+
+
+\subsection{Les macros renvoyant des nombres}
+\subsubsection{StrLen}
+\verb|\StrLen|\ARGU{chaine}\arguC{nom}
+\smallskip
+
+Renvoie la longueur de \argu{chaine}.
+
+\Exemple|\StrLen{xstring}|
+\Exemple|\StrLen{A}|
+\Exemple|\StrLen{a bc def }|
+
+\subsubsection{StrCount}
+\verb|\StrCount|\ARGU{chaine}\ARGU{chaineA}\arguC{nom}
+\smallskip
+
+Compte combien de fois \argu{chaineA} est contenue dans \argu{chaine}.\par\medskip
+
+\begin{Conditions}
+ \item Si l'un au moins des arguments \argu{chaine} ou \argu{chaineA} est vide, la macro renvoie 0.
+\end{Conditions}
+
+\Exemple|\StrCount{abracadabra}{a}|
+\Exemple|\StrCount{abracadabra}{bra}|
+\Exemple|\StrCount{abracadabra}{tic}|
+\Exemple|\StrCount{aaaaaa}{aa}|
+
+\subsubsection{StrPosition}
+\verb|\StrPosition|\arguC{nombre}\ARGU{chaine}\ARGU{chaineA}\arguC{nom}
+\smallskip
+
+L'argument optionnel \argu{nombre} vaut 1 par défaut.\par\smallskip
+
+Dans \argu{chaine}, renvoie la position de l'occurrence \no\argu{nombre} de \argu{chaineA}.\medskip
+
+\begin{Conditions}
+ \item Si \argu{nombre} est supérieur au nombre d'occurrences de \argu{chaineA}, alors la macro renvoie 0.
+ \item Si \argu{chaine} ne contient pas \argu{chaineA}, alors la macro renvoie 0.
+\end{Conditions}
+\medskip
+
+\Exemple|\StrPosition{xstring}{ring}|
+\Exemple|\StrPosition[4]{abracadabra}{a}|
+\Exemple|\StrPosition[2]{abracadabra}{bra}|
+\Exemple|\StrPosition[9]{abracadabra}{a}|
+\Exemple|\StrPosition{abracadabra}{z}|
+\Exemple|\StrPosition{a bc def }{d}|
+\Exemple|\StrPosition[3]{aaaaaa}{aa}|
+
+\section{Utilisation des macros à des fins de programmation}
+\label{programmation}
+\subsection{Verbatimiser vers une séquence de contrôle}
+La macro \verb|\verbtocs| permet le lire le contenu d'un argument \guill{verb} qui peut contenir les caractères spéciaux : \verb|&|, \verb|~|, \verb|\|, \verb|{|, \verb|}|, \verb|_|, \verb|#|, \verb|$|, \verb|^| et \verb|%|. Les caractères \guill{normaux} gardent leur catcodes naturels, sauf les caractères spéciaux qui prennent un catcode de 12. Ensuite, ces caractères sont assignés à une séquence de contrôle. La syntaxe complète est :\medskip
+
+\hfill\verb|\verbtocs|\ARGU{nom}|\argu{caractères}|\hfill{}
+\smallskip
+
+\argu{nom} est le nom d'une séquence de contrôle qui recevra à l'aide d'un \verb|\edef| les \argu{caractères} dont les caractères spéciaux auront reçu un catcode de 12. \argu{nom} contiendra donc du \texte{10,11,12}\voirdeftexte.\medskip
+
+Par défaut, le caractère délimitant le contenu verb est \guill{|}, étant entendu que ce caractère ne peut être à la fois le délimiteur et être contenu dans ce qu'il délimite. Au cas où on voudrait \guill{verbatimiser} des caractères contenant \guill{|}, on peut changer à tout moment le caractère délimitant le contenu verb par la macro :\par\medskip
+\hfill\verb|\setverbdelim|\ARGU{caractère}\hfill{}\smallskip
+
+Tout \argu{caractère} ayant un catcode de 11 ou 12 peut être utilisé\footnote{Plusieurs caractères peuvent être utilisés au risque d'alourdir la syntaxe de \texttt{\textbackslash verbtocs} ! Pour cette raison, avertissement sera émis si l'argument de \texttt{\textbackslash setverbdelim} contient plusieurs caractères.}. Par exemple, après \verb|\setverbdelim{=}|, un argument textuel verb aura cette syntaxe \verb|=|\argu{caractères}\verb|=|.\medskip
+
+Concernant ces arguments verb, il faut tenir compte des deux points suivants :
+\begin{itemize}
+ \item tous les caractères se trouvant avant |\argu{caractères}| seront ignorés;
+ \item à l'intérieur de l'argument textuel verb, tous les espaces sont comptabilisés même s'ils sont consécutifs.
+\end{itemize}
+\medskip
+
+Exemple :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\resultat} |a & b{ c% d$ e \f|
+ \resultat
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\resultat} |a & b{ c% d$ e \f|
+ \resultat
+\end{minipage}
+
+\subsection{Tokenisation d'un texte vers une séquence de contrôle}
+Le processus inverse de ce qui a été vu au dessus consiste à transformer un \texte{10,11,12} en séquences de contrôle. Pour cela, on dispose de la macro :\medskip
+
+\hfill\verb|\tokenize|\ARGU{nom}\ARGU{séquence de contrôle}\hfill{}
+\smallskip
+
+\argu{séquence de contrôle} est développée le plus possible si l'on a invoqué \verb|\fullexpandarg| (voir page~\pageref{devarg}); elle subit un 1-développement si l'on invoque \verb|\normalexpandarg|. Dans les deux cas, le développement doit donner du \texte{10,11,12}. Ensuite, ce \texte{10,11,12} est transformé en tokens puis assigné à l 'aide d'un \verb|\def| à la séquence de contrôle \argu{nom}.\medskip
+
+Exemple :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\text}|\textbf{a} $\frac{1}{2}$|
+ texte : \text
+ \tokenize{\resultat}{\text}
+ \par
+ résultat : \resultat
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \raggedright
+ \verbtocs{\text}
+ |\textbf{a} $\frac{1}{2}$|
+ texte : \text
+ \tokenize{\resultat}{\text}
+ \par
+ résultat : \resultat
+\end{minipage}
+\medskip
+
+Il est bien évident à la dernière ligne, que l'appel à la séquence de contrôle \verb|\resultat| est ici possible puisque les séquences de contrôle qu'elle contient sont définies.\medskip
+
+\subsection{Développement d'une séquence de contrôle avant une conversion en verb}
+\subsubsection{La macro scancs}
+On peut souhaiter développer une séquence de contrôle avant de convertir ce développement en texte. Pour cela existe la macro :\medskip
+
+\hfill\verb|\scancs|\arguC{nombre}\ARGU{nom}\ARGU{séquence de contrôle}\hfill{}
+\smallskip
+
+Le \argu{nombre} vaut 1 par défaut et représente la profondeur à laquelle va être développée la \argu{séquence de contrôle} avant d'être transformée en caractères de catcode 12 (ou 10 pour l'espace) puis assignée à la séquence de contrôle \argu{nom} qui contiendra donc du \texte{10,12}\voirdeftexte.
+
+\subsubsection{Attention aux catcodes !}
+Prenons un cas simple où la \argu{séquence de contrôle} se développe en texte, comme dans l'exemple suivant :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\test{a b1 d}
+ \scancs{\resultat}{\test}
+ \resultat
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\test{a b1 d}
+ \scancs{\resultat}{\test}
+ \resultat
+\end{minipage}
+\medskip
+
+Mais attention au catcodes !
+
+Dans l'exemple précédent, \verb|\scancs{\resultat}{\test}| n'est pas équivalent à \verb|\edef\resultat{\test}|.\medskip
+
+En effet, dans le 1\ier{} cas avec \verb|\scancs{\resultat}{\test}|, \verb|\resultat| contient du \texte{10,12} (des caractères de catcode 12 et des espaces de catcode 10) et se développe en :\par
+\hfill\verb|a|${}_{12}$\ \verb*| |${}_{10}$\ \verb|b|${}_{12}$\ \verb|1|${}_{12}$\ \verb*| |${}_{10}$\ \verb|d|${}_{12}$\hfill{}
+\medskip
+
+Dans le le second cas avec \verb|\edef\resultat{\test}|, \verb|\resultat| contient des caractères de catcode 11 (les lettres), un caractère de catcode 12 (le chiffre 1) et des espaces de catcode 10, et se développe en :\par
+\hfill\verb|a|${}_{11}$\ \verb*| |${}_{10}$\ \verb|b|${}_{11}$\ \verb|1|${}_{12}$\ \verb*| |${}_{10}$\ \verb|d|${}_{11}$\hfill{}
+
+\subsubsection{Profondeur de développement}
+Si cela s'avère nécessaire, on peut aussi contrôler la profondeur de développement avec l'argument optionnel. Ainsi, dans l'exemple suivant, au 1\ier{} appel de \verb|\scancs|, la séquence de contrôle \verb|\c| subit un 3-developpement qui donne \og{}\verb|1|${}_{12}$\ \verb*| |${}_{10}$\ \verb|z|${}_{11}$\ \verb*| |${}_{10}$\ \verb|3|${}_{12}$\fg{} qui est transformé en \og{}\verb|1|${}_{12}$\ \verb*| |${}_{10}$\ \verb|z|${}_{12}$\ \verb*| |${}_{10}$\ \verb|3|${}_{12}$\fg{}.\smallskip
+
+Par contre, si le $n$-développement donne une séquence de contrôle, alors cette séquence de contrôle est transformée en caractères de catcode 12. Ainsi, au 2\ieme{} appel de \verb|\scancs|, la ligne \verb|\scancs[2]{\resultat}{\c}| procède au 2-développement de la séquence de contrôle \verb|\c| qui donne la séquence de contrôle \fbox{\texttt{\textbackslash a}} qui est transformée en \og{}\verb|\|${}_{12}$~\verb|a|${}_{12}$\fg{}.
+
+L'exemple montre toutes les profondeurs de développement jusqu'à la profondeur 0 :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\a{1 z 3}
+ \def\b{\a}
+ \def\c{\b}
+ \scancs[3]{\resultat}{\c}
+ \resultat\par
+ \scancs[2]{\resultat}{\c}
+ \resultat\par
+ \scancs[1]{\resultat}{\c}
+ \resultat\par
+ \scancs[0]{\resultat}{\c}
+ \resultat
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\a{1 z 3}
+ \def\b{\a}
+ \def\c{\b}
+ \scancs[3]{\resultat}{\c}
+ \resultat\par
+ \scancs[2]{\resultat}{\c}
+ \resultat\par
+ \scancs[1]{\resultat}{\c}
+ \resultat\par
+ \scancs[0]{\resultat}{\c}
+ \resultat
+\end{minipage}
+\medskip
+
+Il est bien évident qu'il faut s'assurer que le développement à la profondeur souhaitée soit possible, sous peine d'erreur à la compilation.\medskip
+
+\subsubsection{Développement de plusieurs séquences de contrôle}
+En toute rigueur, le 3\ieme{} argument \argu{séquence de contrôle} (ou l'un de ses développements) doit contenir une seule et unique séquence de contrôle qui elle seule sera développée. Si ce 3\ieme{} argument ou l'un ses développements contient plusieurs séquences de contrôle, la compilation s'arrête avec un message d'erreur invitant à utiliser la version étoilée. La macro étoilée, d'utilisation plus délicate et qu'il convient donc d'utiliser avec attention, permet en effet de développer \emph{toutes} les séquences de contrôle contenues dans le 3\ieme{} argument à la profondeur spécifiée dans le 1\ier{} argument. Voyons cela sur un exemple :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\a{LaTeX}
+ \def\b{est puissant}
+ \scancs*[1]{\resultat}{\a \b}
+ \resultat\par
+ \scancs*[2]{\resultat}{\a\space\b}
+ \resultat
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\a{LaTeX}
+ \def\b{est puissant}
+ \scancs*[1]{\resultat}{\a \b}
+ \resultat\par
+ \scancs*[2]{\resultat}{\a\space\b}
+ \resultat
+\end{minipage}
+\medskip
+
+Tout d'abord, un message d'attention a été généré à la compilation. Voyons sa signification\ldots\medskip
+
+En premier lieu, on constate qu'il manque une espace entre les mots \guill{LaTeX} et \guill{est}, bien qu'une espace ait été insérée entre les 2 séquences de contrôles \verb|\a| et \verb|\b|. Cela est dû à ce que, lors de la lecture de l'argument, \TeX{} ignore les espaces situées après les séquences de contrôle. Et donc, \verb|{\a \b}| est assimilé à \verb|{\a\b}|, quelque soit le nombre d'espaces insérées entre \verb|\a| et \verb|\b|. Pour avoir notre espace entre \guill{LaTeX} et \guill{est}, on aurait pu utiliser la séquence de contrôle \verb|\space| qui se développe en une espace, et écrire comme 3\ieme{} argument : \verb|{\a\space\b}|. On aurait aussi pu insérer une espace à la fin de la définition de \verb|\a| et écrire \verb|\def\a{LaTeX }|.\medskip
+
+Ensuite, il convient cependant de faire attention lorsqu'on utilise des profondeurs de développement supérieures à 1 : si une séquence de contrôle se $n$-développe en du \texte{10,11,12}, au développement suivant, les espaces seront avalées à la lecture. On le voit dans après la ligne \verb|\scancs*[2]{\result}{\a\space\b}| où \verb|\resultat| contient \guill{LaTeXestpuissant} où tous les espaces ont été mangés lors du 2-développement!\medskip
+
+De plus, et c'est aussi le sens du message d'avertissement généré par la version étoilée, il faut savoir que si le $n$-développement contient des accolades, celles-ci, tout comme les espaces, seront supprimées au développement suivant.\medskip
+
+Enfin, lors de l'utilisation de \verb|\scancs|, une espace est insérée après chaque séquence de contrôle. En effet, la primitive \verb|\detokenize| de $\varepsilon$-\TeX{} qui a été utilisée ici, insère une espace apès chaque séquence de contrôle. Il n'y a pas moyen de l'éviter.\medskip
+
+\subsubsection{Exemples}
+Dans l'exemple suivant, les séquences de contrôle subissent un 2-développement. \verb|\d| donne donc \verb|\b|, et \verb|\b| donne \verb|\textbf{a}\textit{b}|, et on constate bien qu'une espace est insérée après chaque séquence de contrôle. \par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\a{\textbf{a}\textit{b}}
+ \def\b{\a}
+ \def\c{\b}
+ \def\d{\c}
+ \scancs*[2]{\resultat}{\d\b}
+ \resultat
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\a{\textbf{a}\textit{b}}
+ \def\b{\a}
+ \def\c{\b}
+ \def\d{\c}
+ \scancs*[2]{\resultat}{\d\b}
+ \resultat
+\end{minipage}
+\medskip
+
+Voici un exemple illustrant la perte des accolades au développement suivant :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\a{1{2}}
+ \def\b{\a}
+ \scancs*[1]{\resultat}{\b{A}}
+ \resultat\par
+ \scancs*[2]{\resultat}{\b{A}}
+ \resultat\par
+ \scancs*[3]{\resultat}{\b{A}}
+ \resultat\par
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\a{1{2}}
+ \def\b{\a}
+ \scancs*[1]{\resultat}{\b{A}}
+ \resultat\par
+ \scancs*[2]{\resultat}{\b{A}}
+ \resultat\par
+ \scancs*[3]{\resultat}{\b{A}}
+ \resultat\par
+\end{minipage}
+\medskip
+
+Enfin, voici un dernier exemple où l'on met à profit l'espace inséré après chaque séquence de contrôle par \verb|\scancs| pour trouver la $n$\ieme{} séquence de contrôle dans le développement d'une séquence de contrôle.
+
+Dans l'exemple ci-dessous, on cherchera la 4\ieme{} séquence de contrôle dans \verb|\myCS| qui contient :\par\medskip
+\hfill\verb|\a xy{3 2}\b7\c123 {m}\d{8}\e|\hfill{}
+\medskip
+
+On cherche bien évidemment à obtenir \verb|\d| !\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\antislash}|\|
+ \newcommand\findcs[2]{%
+ \scancs[1]{\theCS}{#2}%
+ \tokenize{\theCS}{\theCS}%
+ \scancs[1]{\theCS}{\theCS}%
+ \StrBehind[#1]{\theCS}{\antislash}[\theCS]%
+ \StrBefore{\theCS}{ }[\theCS]%
+ \edef\theCS{\antislash\theCS}}
+ \verbtocs{\myCS}|\a xy{3 2}\b7\c123 {m}\d{8}\e|
+ % ici, \myCS contient du texte
+ \findcs{4}{\myCS}
+ \theCS\par
+ \def\myCS{\a xy{3 2}\b7\c123 {m}\d{8}\e}
+ % ici, \myCS contient des séquences de contrôle
+ \findcs{4}{\myCS}
+ \theCS
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\antislash}|\|
+ \newcommand\findcs[2]{%
+ \scancs[1]{\theCS}{#2}%
+ \tokenize{\theCS}{\theCS}%
+ \scancs[1]{\theCS}{\theCS}%
+ \StrBehind[#1]{\theCS}{\antislash}[\theCS]%
+ \StrBefore{\theCS}{ }[\theCS]%
+ \edef\theCS{\antislash\theCS}}
+ \verbtocs{\myCS}|\a xy{3 2}\b7\c123 {m}\d{8}\e|
+ % ici, \myCS contient du texte
+ \findcs{4}{\myCS}
+ \theCS\par
+ \def\myCS{\a xy{3 2}\b7\c123 {m}\d{8}\e}
+ % ici, \myCS contient des séquences de contrôle
+ \findcs{4}{\myCS}
+ \theCS
+\end{minipage}
+\medskip
+
+Au début de la macro \verb|\findcs|, les appels successifs à \verb|\tokenize| puis une deuxième fois à \verb|\scancs| sont nécessaires pour que la macro fonctionne dans le cas où l'argument est une séquence de contrôle se développant en du \texte{10,11,12} : de cette façon en \guill{tokenisant} puis \guill{detokenisant}, des espaces seront bien insérés après chaque séquence de contrôle.
+
+\subsection{À l'interieur d'une définition de macro}
+Certaines difficultés surviennent lorsque l'on se trouve à l'intérieur de la définition d'une macro, c'est-à-dire entre les accolades suivant un \verb|\def\macro| ou un \verb|\newcommand\macro|.\medskip
+
+Pour les mêmes raison qu'il est interdit d'employer la commande \verb|\verb| à l'intérieur de la définition d'une macro, les arguments textuels verb du type |\argu{caractères}| sont également interdits. Il faut donc observer la règle suivante :\par\medskip
+\hfill \textbf{Ne pas utiliser d'argument textuel verb \og{}|\argu{texte}|\fg{} à l'intérieur de la définition d'une macro}.\hfill{}\medskip
+
+Par conséquent, la macro \verb|\verbtocs| est interdite à l'intérieur de la définition d'une macro.\bigskip
+
+Mais alors, comment faire pour manipuler des arguments textuels verb et \guill{verbatimiser} dans les définitions de macro ?\bigskip
+
+Il y a la primitive \verb|\detokenize| de $\varepsilon$-\TeX, mais elle comporte des restrictions, entre autres :
+\begin{itemize}
+ \item les accolades doivent être équilibrées;
+ \item les espaces consécutifs sont ignorés;
+ \item les signes \verb|%| sont interdits;
+ \item une espace est ajoutée après chaque séquence de contrôle;
+ \item les caractères \verb|#| sont doublés.
+\end{itemize}
+\medskip
+
+Il est préférable d'utiliser la macro \verb|\scancs|, et définir avec \verb|\verbtocs| à l'extérieur des définitions de macros, des séquences de contrôle contenant des caractères spéciaux. On pourra aussi utiliser la macro \verb|\tokenize| pour transformer le résultat final (qui est une chaîne de caractères) en une séquence de contrôle. On peut voir des exemples utilisant ces macros page~\pageref{exemples}, à la fin de ce manuel.\medskip
+
+Dans l'exemple artificiel\footnote{On peut agir beaucoup plus simplement en utilisant la commande \texttt{\textbackslash detokenize}. Il suffit de définir la macro ainsi :\par\texttt{\textbackslash newcommand\textbackslash bracearg[1]\{\textbackslash detokenize\{\{\#1\}\}\}}} qui suit, on écrit une macro qui met son argument entre accolades. Pour cela, on définit en dehors de la définition de la macro 2 séquences de contrôles \verb|\Ob| et \verb|\Cb| contenant une accolade ouvrante et une accolade fermante. Ces séquences de contrôle sont ensuite développées et utilisées à l'intérieur de la macro pour obtenir le résultat voulu :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\Ob}|{|
+ \verbtocs{\Cb}|}|
+ \newcommand\bracearg[1]{%
+ \def\text{#1}%
+ \scancs*{\result}{\Ob\text\Cb}%
+ \result}
+ \bracearg{xstring}\par
+ \bracearg{\a}
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\Ob}|{|
+ \verbtocs{\Cb}|}|
+ \newcommand\bracearg[1]{%
+ \def\text{#1}%
+ \scancs*{\result}{\Ob\text\Cb}%
+ \result}
+ \bracearg{xstring}\par
+ \bracearg{\a}
+\end{minipage}
+
+\subsection{Macros étoilées}
+Comme \verb|\scancs| donne du \texte{10,12}\voirdeftexte, cela pose des problèmes pour les macros listées au chapitre~\ref{listemacros}, car elles tiennent compte du catcode des caractères de leurs arguments textuels.\medskip
+
+Voici un exemple :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\mytext}|a b c|
+ \IfSubStr{\mytext}{b}{vrai}{faux}
+ \par
+ \edef\onecs{x y z}
+ \scancs[1]\mycs\onecs
+ \IfSubStr{\mycs}{y}{vrai}{faux}
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\mytext}|a b c|
+ \IfSubStr{\mytext}{b}{vrai}{faux}
+ \par
+ \edef\onecs{x y z}
+ \scancs[1]\mycs\onecs
+ \IfSubStr{\mycs}{y}{vrai}{faux}
+\end{minipage}
+\medskip
+
+Le premier test renvoie vrai puisque la macro \verb|\verbtocs| ne modifie pas les catcodes des caractères non spéciaux : ainsi, \verb|\mytext| se développe en \og{}\verb|a|${}_{11}$\ \verb*| |${}_{10}$\ \verb|b|${}_{11}$\ \verb*| |${}_{10}$\ \verb|c|${}_{11}$\fg{} qui contient bien le deuxième argument qui est \og{}\verb|b|${}_{11}$\fg{}.\medskip
+
+Pour le second test, puisque \verb|\scancs| donne du \texte{10,12}, il renvoit faux puisque \verb|\mycs| se développe en\newline\og{}\verb|x|${}_{12}$\ \verb*| |${}_{10}$\ \verb|y|${}_{12}$\ \verb*| |${}_{10}$\ \verb|z|${}_{12}$\fg{} qui ne contient pas le deuxième argument qui est \og{}\verb|y|${}_{11}$\fg{}.\bigskip
+
+Pour éviter ce désagrément dû à cette différence de catcodes, et les rendre \guill{compatibles} avec \verb|\scancs|, les macros présentées au chapitre \ref{listemacros} ont toutes une version étoilée qui converti le contenu des arguments textuels en caractères dont les catcodes sont 12 uniquement, ou 10 pour les espaces :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \edef\onecs{x y z}
+ \scancs[1]\mycs\onecs
+ \IfSubStr*{\mycs}{y}{vrai}{faux}
+ \end{boxedverbatim}
+ \hspace{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \edef\onecs{x y z}
+ \scancs[1]\mycs\onecs
+ \IfSubStr*{\mycs}{y}{vrai}{faux}
+\end{minipage}
+
+\subsection{Exemples d'utilisation en programmation}
+\label{exemples}
+Voici quelques exemples très simples d'utilisation des macros comme on pourrait en rencontrer en programmation.
+
+\subsubsection{Exemple 1}
+On cherche à remplacer les deux premiers \verb|\textit| par \verb|\textbf| dans la séquence de contrôle \verb|\myCS| qui contient :\par\smallskip
+\hfill\verb|\textit{A}\textit{B}\textit{C}|\hfill{}
+\medskip
+
+On cherche évidemment à obtenir : \textbf{A}\textbf{B}\textit{C}\medskip
+
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\myCS{\textit{A}\textit{B}\textit{C}}
+ \scancs[1]{\text}{\myCS}
+ \StrSubstitute*[2]{\text}{textit}{textbf}[\text]
+ \tokenize{\myCS}{\text}
+ \myCS
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\myCS{\textit{A}\textit{B}\textit{C}}
+ \scancs[1]{\text}{\myCS}
+ \StrSubstitute*[2]{\text}{textit}{textbf}[\text]
+ \tokenize{\myCS}{\text}
+ \myCS
+\end{minipage}
+
+\subsubsection{Exemple 2}
+Cherchons à écrire une macro \verb|\tofrac| qui transforme une écriture du type \guill{a/b} par \guill{$\frac{a}{b}$} :\par\medskip
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \verbtocs{\csfrac}|\frac|%
+ \verbtocs{\Ob}|{|%
+ \verbtocs{\Cb}|}|%
+ \newcommand\tofrac[1]{%
+ \scancs[0]{\myfrac}{#1}%
+ \StrBefore{\myfrac}{/}[\num]%
+ \StrBehind{\myfrac}{/}[\den]%
+ \tokenize\myfrac{\csfrac\Ob\num\Cb\Ob\den\Cb}%
+ $\myfrac$}
+ \tofrac{15/9}
+ \tofrac{u_{n+1}/u_n}
+ \tofrac{a^m/a^n}
+ \tofrac{x+\sqrt{x}/\sqrt{x^2+x+1}}
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \verbtocs{\csfrac}|\frac|%
+ \verbtocs{\Ob}|{|%
+ \verbtocs{\Cb}|}|%
+ \newcommand\tofrac[1]{%
+ \scancs[0]{\myfrac}{#1}%
+ \StrBefore{\myfrac}{/}[\num]%
+ \StrBehind{\myfrac}{/}[\den]%
+ \tokenize\myfrac{\csfrac\Ob\num\Cb\Ob\den\Cb}%
+ $\myfrac$}
+ \tofrac{15/9}
+ \tofrac{u_{n+1}/u_n}
+ \tofrac{a^m/a^n}
+ \tofrac{x+\sqrt{x}/\sqrt{x^2+x+1}}
+\end{minipage}
+
+\subsubsection{Exemple 3}
+Soit une phrase composée de texte. Dans une séquence de contrôle \verb|\phrase|, essayons de mettre en gras le 1\ier{} mot qui suit le mot \guill{package}. Nous prendrons par exemple comme phrase :\par\medskip
+\hfill\verb|Le package xstring est nouveau.|\hfill{}\bigskip
+\setverbdelim{|}
+
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\phrase{Le package xstring est nouveau.}
+ \def\mot{package}
+ \StrBehind[1]{\phrase}{\mot}[\nom]
+ \IfBeginWith{\nom}{ }%
+ {\StrGobbleLeft{\nom}{1}[\nom]}%
+ {}%
+ \StrBefore{\nom}{ }[\nom]
+ \verbtocs{\avant}|\textbf{|
+ \verbtocs{\apres}|}|
+ \StrSubstitute[1]%
+ {\phrase}{\nom}{\avant\nom\apres}[\phrase]
+ \tokenize{\phrase}{\phrase}
+ \phrase
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\phrase{Le package xstring est nouveau.}
+ \def\mot{package}
+ \StrBehind[1]{\phrase}{\mot}[\nom]
+ \IfBeginWith{\nom}{ }%
+ {\StrGobbleLeft{\nom}{1}[\nom]}%
+ {}%
+ \StrBefore{\nom}{ }[\nom]
+ \verbtocs{\avant}|\textbf{|
+ \verbtocs{\apres}|}|
+ \StrSubstitute[1]%
+ {\phrase}{\nom}{\avant\nom\apres}[\phrase]
+ \tokenize{\phrase}{\phrase}
+ \phrase
+\end{minipage}
+
+\subsubsection{Exemple 4}
+Soit une séquence de contrôle \verb|\myCS| définie par un \verb|\def| contenant des séquences de contrôles avec leurs éventuels arguments. Comment intervertir les 2 premières séquences de contrôle ? On prendra comme exemple une séquence de contrôle contenant :\par\medskip
+\hfill\verb|\textbf{A}\textit{B}\texttt{C}|\hfill{}\bigskip
+
+On cherche à obtenir une séquence de contrôle finale contenant \verb|\textit{B}\textbf{A}\texttt{C}| et donnant : \textit{B}\textbf{A}\texttt{C}\medskip
+
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \def\myCS{\textbf{A}\textit{B}\texttt{C}}
+ \scancs[1]{\chaine}{\myCS}
+ \verbtocs{\antislash}|\|
+ \StrBefore[3]{\chaine}{\antislash}[\firsttwo]
+ \StrBehind{\chaine}{\firsttwo}[\others]
+ \StrBefore[2]{\firsttwo}{\antislash}[\avant]
+ \StrBehind{\firsttwo}{\avant}[\apres]%
+ \tokenize{\myCS}{\apres\avant\others}%
+ résultat : \myCS
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \def\myCS{\textbf{A}\textit{B}\texttt{C}}
+ \scancs[1]{\chaine}{\myCS}
+ \verbtocs{\antislash}|\|
+ \StrBefore[3]{\chaine}{\antislash}[\firsttwo]
+ \StrBehind{\chaine}{\firsttwo}[\others]
+ \StrBefore[2]{\firsttwo}{\antislash}[\avant]
+ \StrBehind{\firsttwo}{\avant}[\apres]%
+ \tokenize{\myCS}{\apres\avant\others}%
+ résultat : \myCS
+\end{minipage}
+
+\subsubsection{Exemple 5}
+Soit une séquence de contrôle \verb|\myCS| définie par un \verb|\def| contenant des séquences de contrôles et des groupes entre accolades. Essayons de trouver le $n$\ieme{} groupe, c'est à dire ce qui se trouve entre la $n$\ieme{} paire d'accolades équilibrées. On prendra comme exemple une séquence de contrôle contenant :\par\medskip
+\hfill\verb|\a{1\b{2}}\c{3}\d{4\e{5}\f{6{7}}}|\hfill{}\medskip
+
+\begin{minipage}[r]{0.6\linewidth}
+ \hfill
+ \begin{boxedverbatim}
+ \newcount\occurr
+ \newcount\nbgroup
+ \newcommand\findgroup[2]{%
+ \scancs[1]{\chaine}{#2}%
+ \occurr=0
+ \nbgroup=0
+ \def\findthegroup{%
+ \StrBehind{\chaine}{\Obr}[\remain]%
+ \advance\occurr by 1% accolade fermante suivante
+ \StrBefore[\the\occurr]{\remain}{\Cbr}[\group]%
+ \StrCount{\group}{\Obr}[\nbA]%
+ \StrCount{\group}{\Cbr}[\nbB]%
+ \ifnum\nbA=\nbB% accolades équilibrées ?
+ \advance\nbgroup by 1
+ \ifnum\nbgroup<#1% si c'est pas le bon groupe
+ \StrBehind{\chaine}{\group}[\chaine]%
+ \occurr=0% on initialise \chaine et \occur
+ \findthegroup% et on recommence
+ \fi
+ \else% accolades non équilibrées ?
+ % cherche accolade fermante suivante
+ \findthegroup
+ \fi}
+ \findthegroup
+ \group}
+
+ \verbtocs{\Obr}|{|
+ \verbtocs{\Cbr}|}|
+ \def\myCS{\a{1\b{2}}\c{3}\d{4\e{5}\f{6{7}}}}
+ groupe 1: \findgroup{1}{\myCS}\par
+ groupe 2: \findgroup{2}{\myCS}\par
+ groupe 3: \findgroup{3}{\myCS}
+ \end{boxedverbatim}
+ \hspace*{0.3cm}
+\end{minipage}%
+\begin{minipage}[r]{0.3\linewidth}
+ \newcount\occurr
+ \newcount\nbgroup
+ \newcommand\findgroup[2]{%
+ \scancs[1]{\chaine}{#2}%
+ \occurr=0
+ \nbgroup=0
+ \def\findthegroup{%
+ \StrBehind{\chaine}{\Obr}[\remain]%
+ \advance\occurr by 1% accolade fermante suivante
+ \StrBefore[\the\occurr]{\remain}{\Cbr}[\group]%
+ \StrCount{\group}{\Obr}[\nbA]%
+ \StrCount{\group}{\Cbr}[\nbB]%
+ \ifnum\nbA=\nbB% accolades équilibrées ?
+ \advance\nbgroup by 1
+ \ifnum\nbgroup<#1% si c'est pas le bon groupe
+ \StrBehind{\chaine}{\group}[\chaine]%
+ \occurr=0% on initialise \chaine et \occur
+ \findthegroup% et on recommence
+ \fi
+ \else% accolades non équilibrées ?
+ % cherche accolade fermante suivante
+ \findthegroup
+ \fi}
+ \findthegroup
+ \group}
+
+ \verbtocs{\Obr}|{|
+ \verbtocs{\Cbr}|}|
+ \def\myCS{\a{1\b{2}}\c{3}\d{4\e{5}\f{6{7}}}}
+ groupe 1: \findgroup{1}{\myCS}\par
+ groupe 2: \findgroup{2}{\myCS}\par
+ groupe 3: \findgroup{3}{\myCS}
+\end{minipage}
+\medskip
+
+On peut observer qu'il faut deux compteurs, deux tests et une double récursivité pour trouver le bon groupe : un de chaque pour compter quelle accolade fermante va délimiter le groupe en cours, et l'autre pour compter quel groupe est examiné.\bigskip\bigskip
+
+\begin{center}
+$\star$
+
+$\star$\quad$\star$
+\end{center}
+\bigskip\bigskip
+
+C'est tout, j'espère que ce package vous sera utile !\par
+Merci de me signaler par email tout bug ou toute proposition d'amélioration\ldots\medskip
+
+Christian Tellechea
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/xstring/xstring_test.pdf b/Master/texmf-dist/doc/latex/xstring/xstring_test.pdf
new file mode 100755
index 00000000000..f63a66720ee
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xstring/xstring_test.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/xstring/xstring_test.tex b/Master/texmf-dist/doc/latex/xstring/xstring_test.tex
new file mode 100755
index 00000000000..fd853f16b4a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xstring/xstring_test.tex
@@ -0,0 +1,552 @@
+\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} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/xstring/xstring.sty b/Master/texmf-dist/tex/latex/xstring/xstring.sty
new file mode 100644
index 00000000000..c9a7c45b588
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/xstring/xstring.sty
@@ -0,0 +1,704 @@
+% __________________________________________________
+% | |
+% | |
+% | xstring v1.0 |
+% | |
+% | July, 4th 2008 |
+% | |
+% |__________________________________________________|
+%
+% This is xtring.sty
+%
+% Christian Tellechea 2008
+% email : unbonpetit@gmail.com
+% -------------------------------------------------------------------
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+% -------------------------------------------------------------------
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Christian Tellechea
+%
+% This work consists of the files
+% xstring.sty (this file)
+% readme.txt
+% xstring_doc_fr.tex, xstring_doc_fr.pdf (manual in french)
+% xstring_doc_en.tex, xstring_doc_en.pdf (manual in english)
+% xstring_test.tex, xstring_test.pdf (test file)
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{xstring}[2008/07/04 v1.0 Extended macros for strings. C Tellechea]
+
+% Messages pour situations particulières
+\newcommand\@xs@BadNumArg {\PackageInfo{xstring}{numerical argument out of range}}
+\newcommand\@xs@ArgNotFound {\PackageInfo{xstring}{substring not found in string}}
+\newcommand\@xs@ArgEmpty {\PackageInfo{xstring}{empty argument}}
+
+% Ouvre un groupe où les catcodes sont à 12 et à 10 pour les espaces
+% ensuite, appelle \@xs@ReadVerb qui lit un argument entre délimiteurs verb
+\newcommand\@xs@MakeVerb{% lit 1 argument et le transforme en verb
+ \begingroup% groupe où les catcodes sont à 12 pour la lecture suivante
+ \let\do\@makeother
+ \dospecials% on entre dans le mode verb
+ \obeyspaces% et on tient compte des espaces
+ \@xs@ReadVerb}% et on va lire l'argument
+
+% Définit \@xs@ReadVerb qui lit un argument entre délimiteurs verb
+\newcommand\setverbdelim[1]{% définit quel est le délimiteur de verb
+ \@xs@StrLen{#1}[\@len@verbdelim]%
+ \ifnum\@len@verbdelim=\@ne
+ \else
+ \PackageWarning{xstring}{verb delimiter is not a single char}%
+ \fi
+ \def\@xs@ReadVerb##1#1##2#1{% lit ##2 qui est entre les délimiteurs de verb
+ \endgroup% on ferme le groupe
+ \@xs@afterreadverb{##2}}}% on appelle l'exécution de fin
+
+% Assigne l'argument entre délimiteur verb dans la sc #1
+\newcommand\verbtocs[1]{%
+ \def\@xs@afterreadverb##1{\edef#1{##1}}%
+ \@xs@MakeVerb}
+
+% A l'aide d'un pont d'\expandafter, développe d'un niveau toutes
+% les sc de #1 puis et assigne le résultat à \result
+\def\@xs@expandallonelevel#1#2\@nil{%
+ \expandafter\expandafter\expandafter\def% plein d'expandafter
+ \expandafter\expandafter\expandafter\result% pour développer #1 d'un niveau
+ \expandafter\expandafter\expandafter{\expandafter\result#1}% et l'ajouter à \result
+ \ifx\@empty#2\@empty\else\@xs@expandallonelevel#2\@nil\fi}% s'il reste des sc, on boucle
+
+% \scancs développe #3 autant de fois que spécifié en #1
+% puis le développement obtenu est verbatimisé.
+% On utilise \@xs@expandalltodepth autant de fois que #1 le spécifie
+% puis on invoque \detokenize à la fin
+\newcount\depth@scancs
+\newcommand\scancs{%
+ \@ifstar%
+ {\PackageWarning{xstring}{if third argument or its expansion have braces or spaces, they will be removed when scanned! Use starred \string\scancs* macro with care}%
+ \def\@testornot{\@notestcs}%
+ \@xs@scancs}%
+ {\def\@testornot{\@testcs}%
+ \@xs@scancs}}
+\newcommand\@xs@scancs[3][1]{%
+% #1 : profondeur à développer avant de verbatimiser
+% #2 : nom de la sc recevant la chaine verb
+% #3 : nom de la sc à développer et à transformer en verb
+ \depth@scancs\z@
+ \def\@notestcs##1\@nil{\relax}%
+ \def\@testcs##1##2\@nil{%
+ \ifx\@empty##2\@empty
+ \else% si la séquence de contrôle n'est pas seule, on gueule
+ \PackageError{xstring}{third argument or its expansion is not a single control sequence! Use \string\scancs* instead of \string\scancs (see manual).}%
+ \fi}%
+ \def\@xs@expandalltodepth##1\@nil{% développe de #1 niveaux toutes les sc de #3 et l'assigne à \the@result
+ \def\result{}%
+ \ifnum\depth@scancs<#1% tant que la profondeur de développement n'est pas atteinte
+ \@testornot##1\@nil% on teste éventuellement si le développement comporte 1 seule sc
+ \expandafter\@xs@expandallonelevel\the@result\@nil% on développe tout d'un niveau
+ \expandafter\def\expandafter\the@result\expandafter{\result}%
+ \advance\depth@scancs\@ne
+ \expandafter\@xs@expandalltodepth\the@result\@nil% et on recommence
+ \fi}%
+ \def\the@result{#3}%
+ \@xs@expandalltodepth#3\@nil
+ \expandafter\def\expandafter#2\expandafter{\detokenize\expandafter{\the@result}}}
+
+% Cette macro développe #2 au maximum (ce qui doit donner du texte),
+% puis le transforme en token et l'assigne à #1
+% On ouvre un groupe dans lequel un \@nil est inséré à la fin du fichier virtuel
+% lu avec \scantokens. Ce \@nil sert à l'argument délimité de \@AssignResult
+\newcommand\tokenize[2]{%
+ \begingroup
+ \expandafter\@xs@def\expandafter\the@text\expandafter{#2}% on développe en accord avec \fullexpandarg ou \noexpandarg
+ \def\@AssignResult##1\@nil{\def#1{##1}}% on assigne en tenant compte du \@nil qui vient de la fin du fichier virtuel
+ \everyeof{\@nil}% met un \@nil à la fin du fichier virtuel
+ \endlinechar\m@ne
+ \expandafter\expandafter\expandafter\endgroup% on retarde la fermeture du groupe
+ \expandafter\@AssignResult\scantokens\expandafter{\the@text}}% pout faire l'assignation
+
+% Macro très simple qui assigne ou affiche le résultat, selon la présence
+% ou non de #2 qui est l'argument optionnel venant en dernière position des macros
+\newcommand\@xs@ReturnResult[2]{%
+ \expandafter\ifx\expandafter\@empty\detokenize{#2}\@empty% pas de nom ?
+ #1% on affiche #1
+ \else% il y a un nom donc
+ \edef#2{#1}% on met #1 dans #3 avec edef
+ \fi}
+
+% Pas d'expansion des arguments
+\newcommand\normalexpandarg{%
+ \let\@xs@def\def% on définit\@call avec \def
+ \let\@xs@expand\@empty}% et on neutralise \@xs@expand
+
+% Expansion des arguments
+\newcommand\fullexpandarg{%
+ \let\@xs@def\edef% on définit\@call avec \edef
+ \let\@xs@expand\noexpand}% et on utilise \noexpand
+
+% Cette macro interne enlève le 1er caractère de la chaine passée en argument
+\def\@xs@RemoveFirst#1[#2]{%
+ \ifx\@empty#1\@empty
+ \edef#2{}%
+ \else
+ \@xs@IfBeginWith{#1}{ }%
+ {\@xs@StrBehind[1]{#1}{ }[#2]}%
+ {\def\@xs@RemoveFirst@ii##1##2\@nil{\edef#2{##2}}%
+ \@xs@RemoveFirst@ii#1\@nil}%
+ \fi}
+
+% Cette macro interne renvoie le 1er caractère de la chaine passée en argument
+\def\@xs@ReturnFirst#1[#2]{%
+ \ifx\@empty#1\@empty%
+ \edef#2{}%
+ \else
+ \@xs@IfBeginWith{#1}{ }%
+ {\edef#2{ }}%
+ {\def\@xs@ReturnFirst@ii##1##2\@nil{\edef#2{##1}}%
+ \@xs@ReturnFirst@ii#1\@nil}%
+ \fi}
+
+% Cette macro interne est utilisée dans les macros étoilées pour :
+% 1) développer l'argument selon qu'on a choisit \fullexpandarg
+% ou \normalexpandarg, et ceci à l'aide de la macro \@xs@def
+% 2) Ensuite, on détokenize ce développement de façon n'avoir plus que
+% des catcodes de 10 pour les espaces et 12 pour le reste.
+\newcommand\@xs@expand@and@detokenize[2]{%
+ \@xs@def#1{#2}% on développe #2 selon \fullexpandarg ou \normalexpandarg
+ \edef#1{\detokenize\expandafter{#1}}}% puis on détokenize et on assigne à #1
+
+% Cette macro teste si une chaine (#2) en contient au moins n(#1) fois une autre (#3)
+% Pour cela, on teste "ce qu'il reste" après #2. On construit une récursivité sur le
+% compteur d'occurences \Occurrence@IfSubStr. Si "ce qu'il reste" est vide avant d'atteindre
+% l'occurence voulue, le test est négatif, sinon on poursuit par récursivité sur "ce qu'il reste"
+% jusqu'à l'occurrence voulue. Si l'on atteint l'occurrence voulue, le test est positif.
+% On utilise la séquence de contrôle non définie \@delimit pour éviter un effet
+% indésirable qui ferait que \IfSubStr{a}{aa}{V}{F} renverrait V
+\newcommand\IfSubStr{\@ifstar\@xs@IfSubStr@@\@xs@IfSubStr@}%
+\newcommand\@xs@IfSubStr@@[3][1]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#2}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#3}%
+ \edef\@call{\noexpand\@xs@IfSubStr[\@xs@expand#1]{\xsarg@a}{\xsarg@b}}%
+ \@call}
+\newcommand\@xs@IfSubStr@[3][1]{%
+ \@xs@def\@call{\@xs@expand\@xs@IfSubStr[#1]{#2}{#3}}%
+ \@call}
+\newcount\Occurrence@IfSubStr
+\def\@xs@IfSubStr[#1]#2#3{%
+% est ce que la chaine #2 contient au moins #1 fois la sous chaine #3 ?
+ \ifnum#1<\@ne% on gère les cas spéciaux
+ \def\@xsresult@IfSubStr{\expandafter\@secondoftwo}% #1<1 -> on exécute #5
+ \else
+ \ifx\@empty#3\@empty%
+ \def\@xsresult@IfSubStr{\expandafter\@secondoftwo}% si #3 est vide -> on écécute #5
+ \else
+ \Occurrence@IfSubStr\z@
+ \def\@xs@IfSubStr@i##1#3##2\@nil{%
+ \advance\Occurrence@IfSubStr\@ne
+ \ifx\@empty##2\@empty%% qu'y a t-il apès la sous chaine ?
+ \def\@xsresult@IfSubStr{\expandafter\@secondoftwo}% rien -> on exécute #5
+ \else% si ce qu'il est reste n'est pas vide
+ \ifnum\Occurrence@IfSubStr<#1% tant que le nombre d'occurrence n'est pas atteint
+ \@xs@IfSubStr@i##2\@nil% on recommence
+ \else
+ \def\@xsresult@IfSubStr{\expandafter\@firstoftwo}% nombre d'occurrences atteint : on renvoie #4
+ \fi
+ \fi}%
+ \@xs@IfSubStr@i#2\@delimit#3\@nil% \@delimit pour éviter le cas de \IfSubStr{a}{aa}{V}{F} qui renverrait V
+ \fi
+ \fi
+ \@xsresult@IfSubStr}
+
+\newcommand\IfBeginWith{\@ifstar\@xs@IfBeginWith@@\@xs@IfBeginWith@}%
+\newcommand\@xs@IfBeginWith@@[2]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#2}%
+ \edef\@call{\noexpand\@xs@IfBeginWith{\xsarg@a}{\xsarg@b}}
+ \@call}
+\newcommand\@xs@IfBeginWith@[2]{%
+ \@xs@def\@call{\@xs@expand\@xs@IfBeginWith{#1}{#2}}%
+ \@call}
+\newcommand\@xs@IfBeginWith[2]{%
+ \@xs@IfSubStr[1]{#1}{#2}%
+ {\ifx\@empty#2\@empty%
+ \def\@xs@IfBeginWith@i##1\@nil{\expandafter\@firstoftwo}% si #2 est vide, on renvoie vrai
+ \else
+ \def\@xs@IfBeginWith@i##1#2##2\@nil{% qu'y a t-il avant #2 ?
+ \ifx\@empty##1\@empty
+ \expandafter\@firstoftwo% rien, donc #2 est au début, on renvoie vrai
+ \else
+ \expandafter\@secondoftwo
+ \fi}%
+ \fi}%
+ {\def\@xs@IfBeginWith@i##1\@nil{\expandafter\@secondoftwo}}% si #2 n'est pas dans #1, on renvoie faux
+ \@xs@IfBeginWith@i#1\@delimit#2\@nil}
+
+\newcommand\IfEndWith{\@ifstar\@xs@IfEndWith@@\@xs@IfEndWith@}%
+\newcommand\@xs@IfEndWith@@[2]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#2}%
+ \edef\@call{\noexpand\@xs@IfEndWith{\xsarg@a}{\xsarg@b}}
+ \@call}
+\newcommand\@xs@IfEndWith@[2]{%
+ \@xs@def\@call{\@xs@expand\@xs@IfEndWith{#1}{#2}}%
+ \@call}
+\newcommand*\@xs@IfEndWith[2]{%
+% Est ce que la chaine #1 finit par la chaine #2 ?
+ \@xs@IfSubStr[1]{#1}{#2}%
+ {\ifx\@empty#2\@empty% si #2 est vide -> test vrai
+ \def\@xs@remove@begining##1\@nil{\expandafter\@firstoftwo}%
+ \else
+ \def\@xs@remove@begining##1#2##2\@nil{% on isole ce qui est après #2, la chaine restante ##2
+ \@xs@IfSubStr[1]{##2}{#2}% tant que #2 est dans la chaine restante..
+ {\@xs@remove@begining##2\@nil}% ...on recommence
+ {\ifx\@empty##2\@empty% sinon, on regarde ce qui reste
+ \expandafter\@firstoftwo% rien -> test vrai
+ \else
+ \expandafter\@secondoftwo% quelque chose -> test faux
+ \fi
+ }%
+ }%
+ \fi}%
+ {\def\@xs@remove@begining##1\@nil{\expandafter\@secondoftwo}}% si #2 n'est pas dans #1 -> test faux
+ \@xs@remove@begining#2#1\@nil}
+
+\newcount\Occurrence@StrBefore
+% Renvoie ce qui est à gauche de l'occurence n°#1 de la sous chaine #3 dans la chaine #2
+\newcommand\StrBefore{\@ifstar\@xs@StrBefore@@\@xs@StrBefore@}
+\newcommand\@xs@StrBefore@@[3][1]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#2}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#3}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrBefore[\@xs@expand#1]{\xsarg@a}{\xsarg@b}}{}}%
+ \@call}
+\newcommand\@xs@StrBefore@[3][1]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrBefore[#1]{#2}{#3}}{}}%
+ \@call}
+\def\@xs@StrBefore[#1]#2#3[#4]{%
+ \ifx\@empty#3\@empty%
+ \@xs@ArgNotFound% warning
+ \edef\@xs@result@StrBefore{}%
+ \else
+ \edef\@xs@result@StrBefore{}% resultat nul pour l'instant
+ \Occurrence@StrBefore\z@
+ \def\@xs@StrBefore@i##1#3##2\@nil{%
+ \advance\Occurrence@StrBefore\@ne% on incrémente
+ \ifx\@empty##2\@empty% pas trouvé ?
+ \@xs@ArgNotFound% warning
+ \edef\@xs@result@StrBefore{}% renvoie vide
+ \else
+ \ifnum\Occurrence@StrBefore<#1% tant que c'est pas la bonne occurrence
+ \edef\@xs@result@StrBefore{\@xs@result@StrBefore##1#3}% on ajoute le début au résultat final
+ \@xs@StrBefore@i##2\@nil% on recommence avec la chaine restante
+ \else
+ \edef\@xs@result@StrBefore{\@xs@result@StrBefore##1}% on n'ajoute pas la chaine frontière #3 la dernière fois !
+ \fi
+ \fi}%
+ \@xs@StrBefore@i#2\@delimit#3\@nil%
+ \fi
+ \@xs@ReturnResult{\@xs@result@StrBefore}{#4}}
+
+\newcount\Occurrence@StrBehind
+% Renvoie ce qui est à droite de l'occurence n°#1 de la sous chaine #3 dans la chaine #2
+\newcommand\StrBehind{\@ifstar\@xs@StrBehind@@\@xs@StrBehind@}
+\newcommand\@xs@StrBehind@@[3][1]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#2}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#3}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrBehind[\@xs@expand#1]{\xsarg@a}{\xsarg@b}}{}}%
+ \@call}
+\newcommand\@xs@StrBehind@[3][1]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrBehind[#1]{#2}{#3}}{}}%
+ \@call}
+\def\@xs@StrBehind[#1]#2#3[#4]{%
+ \ifx\@empty#3\@empty%
+ \@xs@ArgNotFound% warning
+ \edef\@xs@result@StrBehind{}%
+ \else
+ \Occurrence@StrBehind\z@
+ \def\@xs@StrBehind@i##1#3##2\@nil{%
+ \advance\Occurrence@StrBehind\@ne% on incrémente
+ \ifnum\Occurrence@StrBehind<#1% tant que c'est pas la bonne occurrence
+ \@xs@IfSubStr[1]{##2}{#3}% tant que la chaine restante contient #3
+ {\@xs@StrBehind@i##2\@nil}% on recommence avec la chaine restante
+ {\@xs@ArgNotFound% sinon, info
+ \edef\@xs@result@StrBehind{}}% et on renvoie vide
+ \else
+ \edef\@xs@result@StrBehind{##2}% on renvoie la chaine restante
+ \fi}%
+ \@xs@IfSubStr[1]{#2}{#3}%
+ {\@xs@StrBehind@i#2\@nil}%
+ {\@xs@ArgNotFound% warning
+ \edef\@xs@result@StrBehind{}}%
+ \fi
+ \@xs@ReturnResult{\@xs@result@StrBehind}{#4}}
+
+\newcommand\IfSubStrBefore{\@ifstar\@xs@IfSubStrBefore@@\@xs@IfSubStrBefore@}
+% est ce que l'occurrence #1 de la sous chaine #4 se trouve avant
+% l'occurrence n°#2 de la sous chaine #5 dans la chaine #3?
+\newcommand\@xs@IfSubStrBefore@@[4][1,1]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#2}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#3}%
+ \@xs@expand@and@detokenize{\xsarg@c}{#4}%
+ \edef\@call{\noexpand\@xs@IfSubStrBefore[\@xs@expand#1]{\xsarg@a}{\xsarg@b}{\xsarg@c}}%
+ \@call}
+\newcommand\@xs@IfSubStrBefore@[4][1,1]{%
+ \@xs@def\@call{\@xs@expand\@xs@IfSubStrBefore[#1]{#2}{#3}{#4}}%
+ \@call}
+\def\@xs@IfSubStrBefore[#1,#2]#3#4#5{%
+ \@xs@StrPosition[#2]{#3}{#5}[\@xs@posMax@IfSubStrBefore]% on trouve les positions
+ \@xs@StrPosition[#1]{#3}{#4}[\@xs@posPattern@IfSubStrBefore]%
+ \ifnum\@xs@posMax@IfSubStrBefore<\@ne%
+ \def\@xs@result@IfSubStrBefore{\expandafter\@secondoftwo}% si pas trouvé #5 : 0 renvoie faux
+ \else
+ \ifnum\@xs@posPattern@IfSubStrBefore<\@ne%
+ \def\@xs@result@IfSubStrBefore{\expandafter\@secondoftwo}% si pas trouvé #4 : 0 renvoie faux
+ \else
+ \ifnum\@xs@posPattern@IfSubStrBefore<\@xs@posMax@IfSubStrBefore%
+ \def\@xs@result@IfSubStrBefore{\expandafter\@firstoftwo}%
+ \else
+ \def\@xs@result@IfSubStrBefore{\expandafter\@secondoftwo}%
+ \fi
+ \fi
+ \fi
+ \@xs@result@IfSubStrBefore}
+
+% Est ce que l'occurrence #1 de la sous chaine #4 se trouve avant
+% l'occurrence n°#2 de la sous chaine #5 dans la chaine #3?
+\newcommand\IfSubStrBehind{\@ifstar\@xs@IfSubStrBehind@@\@xs@IfSubStrBehind@}
+\newcommand\@xs@IfSubStrBehind@@[4][1,1]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#2}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#3}%
+ \@xs@expand@and@detokenize{\xsarg@c}{#4}%
+ \edef\@call{\noexpand\@xs@IfSubStrBehind[\@xs@expand#1]{\xsarg@a}{\xsarg@b}{\xsarg@c}}%
+ \@call}
+\newcommand\@xs@IfSubStrBehind@[4][1,1]{%
+ \@xs@def\@call{\@xs@expand\@xs@IfSubStrBehind[#1]{#2}{#3}{#4}}%
+ \@call}
+\def\@xs@IfSubStrBehind[#1,#2]#3#4#5{%
+ \@xs@StrPosition[#2]{#3}{#5}[\@xs@posMax@IfSubStrBehind]% on trouve les positions
+ \@xs@StrPosition[#1]{#3}{#4}[\@xs@posPattern@IfSubStrBehind]%
+ \ifnum\@xs@posMax@IfSubStrBehind<1\relax%
+ \def\@xs@result@IfSubStrBehind{\expandafter\@secondoftwo}% si pas trouvé : 0 renvoie faux
+ \else
+ \ifnum\@xs@posPattern@IfSubStrBehind<1%
+ \def\@xs@result@IfSubStrBehind{\expandafter\@secondoftwo}% si pas trouvé : 0 renvoie faux
+ \else
+ \ifnum\@xs@posPattern@IfSubStrBehind>\@xs@posMax@IfSubStrBehind%
+ \def\@xs@result@IfSubStrBehind{\expandafter\@firstoftwo}%
+ \else
+ \def\@xs@result@IfSubStrBehind{\expandafter\@secondoftwo}%
+ \fi
+ \fi
+ \fi
+ \@xs@result@IfSubStrBehind}
+
+\newcount\Gobble@StrBetween
+% Renvoie ce qui est strictement compris entre les occurrences n°#1 et n°#2
+% des chaines #4 et #5 dans la chaine #3
+\newcommand\StrBetween{\@ifstar\@xs@StrBetween@@\@xs@StrBetween@}
+\newcommand\@xs@StrBetween@@[4][1,1]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#2}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#3}%
+ \@xs@expand@and@detokenize{\xsarg@c}{#4}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrBetween[\@xs@expand#1]{\xsarg@a}{\xsarg@b}{\xsarg@c}}{}}%
+ \@call}
+\newcommand\@xs@StrBetween@[4][1,1]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrBetween[#1]{#2}{#3}{#4}}{}}%
+ \@call}
+\def\@xs@StrBetween[#1,#2]#3#4#5[#6]{%
+ \ifx\@empty#5\@empty%
+ \edef\@xs@StringBefore@StrBetween{}%
+ \else
+ \@xs@StrBefore[#2]{#3}{#5}[\@xs@StringBefore@StrBetween]% on extrait ce qui est à gauche de l'occurrence de #5
+ \@xs@StrPosition[#1]{#3}{#4}[\@xs@Pos@StrBetween]% position de l'occurrence de #3
+ \Gobble@StrBetween\@xs@Pos@StrBetween%
+ \@xs@StrLen{#4}[\@xs@Pos@StrBetween]%
+ \advance\Gobble@StrBetween\@xs@Pos@StrBetween% on lui ajoute la longueur de #3
+ \advance\Gobble@StrBetween\m@ne% et on enlève 1
+ \expandafter\expandafter\expandafter\@xs@StrGobbleLeft%
+ \expandafter\expandafter\expandafter{\expandafter\@xs@StringBefore@StrBetween\expandafter}%
+ \expandafter{\Gobble@StrBetween}[\@xs@result@StrBetween]% pour manger ce nombre de caractère au début de \@xs@StringBefore@StrBetween
+ \fi
+ \@xs@ReturnResult{\@xs@result@StrBetween}{#6}}
+
+\newcount\Occurrence@StrSubstitute
+% Remplace les #1 premières occurences de la chaine #3
+% par la chaine #4 dans la chaine #2
+\newcommand\StrSubstitute{\@ifstar\@xs@StrSubstitute@@\@xs@StrSubstitute@}
+\newcommand\@xs@StrSubstitute@@[4][0]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#2}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#3}%
+ \@xs@expand@and@detokenize{\xsarg@c}{#4}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrSubstitute[\@xs@expand#1]{\xsarg@a}{\xsarg@b}{\xsarg@c}}{}}%
+ \@call}
+\newcommand\@xs@StrSubstitute@[4][0]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrSubstitute[#1]{#2}{#3}{#4}}{}}%
+ \@call}
+\def\@xs@StrSubstitute[#1]#2#3#4[#5]{%
+ \Occurrence@StrSubstitute\z@
+ \ifx\@empty#3\@empty% si #3 est vide, on ne fait rien
+ \@xs@ArgEmpty% warning
+ \edef\@result@StrSubstitute{#2}%
+ \else
+ \edef\@result@StrSubstitute{}% on initialise à vide, histoire d'enlever le statut undefined
+ \def\@xs@StrSubstitute@i##1#3##2\@nil{%
+ \edef\@result@StrSubstitute{\@result@StrSubstitute##1#4}% on recopie jusqu'à la 1ere occurrence, et on remplace #3 par #4
+ \ifnum#1>\z@% si on compte les occurrences
+ \advance\Occurrence@StrSubstitute\@ne% on incrémente le compteur
+ \@xs@IfSubStr[1]{##2}{#3}% tant que la chaine restante contient #3
+ {\ifnum\Occurrence@StrSubstitute<#1% tant qu'on n'a pas atteint la bonne occurrence,
+ \@xs@StrSubstitute@i##2\@nil% on recommence
+ \else
+ \edef\@result@StrSubstitute{\@result@StrSubstitute##2}% l'occurrence est atteinte : on rajoute ce qui reste
+ \fi}%
+ {\edef\@result@StrSubstitute{\@result@StrSubstitute##2}}% si on ne peut plus substituter, on rajoute ce qui reste
+ \else% ici , on ne compte pas les occurrences, donc...
+ \@xs@IfSubStr[1]{##2}{#3}% ...tant que la chaine restante contient #3
+ {\@xs@StrSubstitute@i##2\@nil}% on recommence
+ {\edef\@result@StrSubstitute{\@result@StrSubstitute##2}}% si on ne peut plus substituter, on rajoute ce qui reste
+ \fi}%
+ \@xs@IfSubStr[1]{#2}{#3}%
+ {\@xs@StrSubstitute@i#2\@nil}% si #2 contient #3, on exécute la macro
+ {\edef\@result@StrSubstitute{#2}}% sinon, on renvoie la chaine #2
+ \fi
+ \@xs@ReturnResult{\@result@StrSubstitute}{#5}}
+
+% Supprime les #1 premières occurrences de #3 dans #2
+\newcommand\StrDel{\@ifstar\@xs@StrDel@@\@xs@StrDel@}
+\newcommand\@xs@StrDel@@[3][0]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#2}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#3}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrSubstitute[\@xs@expand#1]{\xsarg@a}{\xsarg@b}{}}{}}%
+ \@call}
+\newcommand\@xs@StrDel@[3][0]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrSubstitute[#1]{#2}{#3}{}}{}}%
+ \@call}
+
+\newcount\Length@StrLen
+% Compte combien de caractères contient la chaine #1 ?
+\newcommand\StrLen{\@ifstar\@xs@StrLen@@\@xs@StrLen@}
+\newcommand\@xs@StrLen@@[1]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrLen{\xsarg@a}}{}}%
+ \@call}
+\newcommand\@xs@StrLen@[1]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrLen{#1}}{}}%
+ \@call}
+% Macro qui compte le nombre de caractères de son argument #1
+\def\@xs@StrLen@i#1\@nil{%
+ \ifx\@empty#1\@empty% tant que #1 n'est pas vide ...
+ \else
+ \advance\Length@StrLen\@ne% ...on ajoute 1 à la longueur
+ \@xs@IfBeginWith{#1}{ }% et on recommence après avoir enlevé le 1er caractère (on distingue le cas où c'est un espace)
+ {\@xs@StrBehind[1]{#1}{ }[\@xs@result@StrLen]%
+ \expandafter\@xs@StrLen@i\@xs@result@StrLen\@nil}%
+ {\expandafter\@xs@StrLen@i\@xs@RemoveFirst@StrLen#1\@nil\@nil}%
+ \fi}%
+% Macro qui enlève le 1er caractère de son argument
+\def\@xs@RemoveFirst@StrLen#1#2\@nil{#2}%
+% Macro principale
+\def\@xs@StrLen#1[#2]{%
+% Renvoie la longueur de la chaine #1
+ \Length@StrLen\z@
+ \@xs@StrLen@i#1\@nil%
+ \expandafter\@xs@ReturnResult\expandafter{\the\Length@StrLen}{#2}}
+
+\newcount\Position@StrMid
+\newcommand\StrMid{\@ifstar\@xs@StrMid@@\@xs@StrMid@}
+\newcommand\@xs@StrMid@@[3]{%
+ \edef\@StrMid@First{\@xs@expand#2}\edef\@StrMid@Last{\@xs@expand#3}% position début et fin
+ \ifnum#2>#3\@xs@BadNumArg\fi
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrMid{\xsarg@a}}{}}%
+ \@call}
+\newcommand\@xs@StrMid@[3]{%
+ \edef\@StrMid@First{\@xs@expand#2}\edef\@StrMid@Last{\@xs@expand#3}% position début et fin
+ \ifnum#2>#3\@xs@BadNumArg\fi
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrMid{#1}}{}}%
+ \@call}
+% cette sous macro supprime le nombre de caractère nécessaires
+% à la gauche de son argument, et renvoie le résultat dans \@result@Mid@Gobble
+\def\@xs@Mid@Gobble#1\@nil{% enlève #2 caractères à gauche de ##1
+ \advance\Position@StrMid\@ne
+ \ifnum\Position@StrMid=\@StrMid@First% si on a atteint la position
+ \edef\@result@Mid@Gobble{#1}% on renvoie ce qui reste
+ \else% sinon
+ \@xs@RemoveFirst{#1}[\@Mid@remain]% on enlève un caractère
+ \expandafter\@xs@Mid@Gobble\@Mid@remain\@nil% et on recommence
+ \fi}%
+% cette sous macro prend le nombre de caractères nécessaires
+% à la gauche de son argument, et renvoie le résultat dans \@final@Result
+\def\@xs@Mid@Concat#1\@nil{%
+ \@xs@ReturnFirst{#1}[\@Char@to@add]% prend le 1er caractère
+ \edef\@final@Result{\@final@Result\@Char@to@add}% l'ajoute au résultat final
+ \@xs@RemoveFirst{#1}[\@remain@StrMid]% puis l'enlève de la chaine
+ \ifnum\Position@StrMid<\@StrMid@Last% si pas encore fini
+ \advance\Position@StrMid\@ne% on incrémente et
+ \expandafter\@xs@Mid@Concat\@remain@StrMid\@nil% on recommence
+ \fi}%
+\def\@xs@StrMid#1[#2]{%
+% renvoie la sous chaine de #1 comprise entre les positions \@StrMid@First et \@StrMid@Last
+ \@xs@StrLen{#1}[\@len@StrMid]%
+ \ifnum\@StrMid@First>\@StrMid@Last% mauvais ordre ?
+ \@xs@ReturnResult{}{#2}% on renvoie rien
+ \else
+ \ifnum\@StrMid@Last<\@ne% si position fin trop petite
+ \@xs@ReturnResult{}{#2}% on renvoie rien
+ \else
+ \ifnum\@StrMid@First<\@ne% 1ère position trop petite ?
+ \edef\@StrMid@First{1}% on limite à 1
+ \@xs@BadNumArg% avertissement
+ \fi
+ \ifnum\@StrMid@Last>\@len@StrMid% dernière position trop grande ?
+ \edef\@StrMid@Last{\@len@StrMid}% on limite à la longueur de la chaine
+ \@xs@BadNumArg% avertissement
+ \fi
+ \Position@StrMid\z@
+ \@xs@Mid@Gobble#1\@nil% on supprime ce qu'il faut à gauche
+ \edef\@final@Result{}% rien dans le résultat final pour l'instant
+ \expandafter\@xs@Mid@Concat\@result@Mid@Gobble\@nil% on prend les caractères qu'il faut à gauche
+ \expandafter\@xs@ReturnResult\expandafter{\@final@Result}{#2}%
+ \fi
+ \fi}
+
+\newcommand\StrGobbleLeft{\@ifstar\@xs@StrGobbleLeft@@\@xs@StrGobbleLeft@}
+% supprime #2 caractères à gauche dans la chaine #1
+\newcommand\@xs@StrGobbleLeft@@[2]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrGobbleLeft{\xsarg@a}{\@xs@expand#2}}{}}%
+ \@call}
+\newcommand\@xs@StrGobbleLeft@[2]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrGobbleLeft{#1}{#2}}{}}%
+ \@call}
+\def\@xs@StrGobbleLeft#1#2[#3]{%
+ \edef\@StrMid@First{\numexpr#2+1}%
+ \@xs@StrLen{#1}[\@StrMid@Last]%
+ \@xs@StrMid{#1}[\@xs@result@StrGobbleLeft]%
+ \@xs@ReturnResult{\@xs@result@StrGobbleLeft}{#3}}
+
+% extrait de #1 la chaine à gauche de longueur #2
+\newcommand\StrLeft{\@ifstar\@xs@StrLeft@@\@xs@StrLeft@}
+\newcommand\@xs@StrLeft@@[2]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrLeft{\xsarg@a}{\@xs@expand#2}}{}}%
+ \@call}
+\newcommand\@xs@StrLeft@[2]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrLeft{#1}{#2}}{}}%
+ \@call}
+\def\@xs@StrLeft#1#2[#3]{%
+ \edef\@StrMid@First{1}%
+ \ifnum#2<0\@xs@BadNumArg\fi% avertissement
+ \edef\@StrMid@Last{#2}%
+ \@xs@StrMid{#1}[\@xs@result@@StrLeft]%
+ \@xs@ReturnResult{\@xs@result@@StrLeft}{#3}}
+
+% supprime #2 caractères à droite dans la chaine #1
+\newcommand\StrGobbleRight{\@ifstar\@xs@StrGobbleRight@@\@xs@StrGobbleRight@}
+\newcommand\@xs@StrGobbleRight@@[2]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrGobbleRight{\xsarg@a}{\@xs@expand#2}}{}}%
+ \@call}
+\newcommand\@xs@StrGobbleRight@[2]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrGobbleRight{#1}{#2}}{}}%
+ \@call}
+\def\@xs@StrGobbleRight#1#2[#3]{%
+ \@xs@StrLen{#1}[\@Result@Length]%
+ \ifnum#2>\@Result@Length\@xs@BadNumArg\fi% avertissement
+ \edef\@StrMid@First{1}%
+ \edef\@StrMid@Last{\numexpr\@Result@Length-#2}%
+ \@xs@StrMid{#1}[\@xs@result@StrGobbleRight]%
+ \@xs@ReturnResult{\@xs@result@StrGobbleRight}{#3}}
+
+% renvoie #2 caractères à la droite de la chaine #1
+\newcommand\StrRight{\@ifstar\@xs@StrRight@@\@xs@StrRight@}
+\newcommand\@xs@StrRight@@[2]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrRight{\xsarg@a}{#2}}{}}%
+ \@call}
+\newcommand\@xs@StrRight@[2]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrRight{#1}{#2}}{}}%
+ \@call}
+\def\@xs@StrRight#1#2[#3]{%
+ \ifnum#2<0\@xs@BadNumArg\fi% avertissement
+ \@xs@StrLen{#1}[\@StrMid@Last]%
+ \edef\@StrMid@First{\numexpr\@StrMid@Last+1-#2}%
+ \@xs@StrMid{#1}[\@xs@result@StrMid]%
+ \@xs@ReturnResult{\@xs@result@StrMid}{#3}}
+
+\newcommand\StrChar{\@ifstar\@xs@StrChar@@\@xs@StrChar@}
+\newcommand\@xs@StrChar@@[2]{%
+ \edef\@StrMid@First{\@xs@expand#2}\edef\@StrMid@Last{\@xs@expand#2}%
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrMid{\xsarg@a}}{}}%
+ \@call}
+\newcommand\@xs@StrChar@[2]{%
+ \edef\@StrMid@First{\@xs@expand#2}\edef\@StrMid@Last{\@xs@expand#2}%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrMid{#1}}{}}%
+ \@call}%
+
+\newcount\Occurrence@StrCount
+% Combien de fois compte t-on #2 dans #1 ?
+\newcommand\StrCount{\@ifstar\@xs@StrCount@@\@xs@StrCount@}
+\newcommand\@xs@StrCount@@[2]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#1}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#2}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrCount{\xsarg@a}{\xsarg@b}}{}}%
+ \@call}
+\newcommand\@xs@StrCount@[2]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrCount{#1}{#2}}{}}%
+ \@call}
+\def\@xs@StrCount#1#2[#3]{%
+ \Occurrence@StrCount\z@% on initialise à 0
+ \def\@xs@StrCount@i{%
+ \advance\Occurrence@StrCount\@ne% occurrence := occurrence +1
+ \@xs@StrPosition[\the\Occurrence@StrCount]{#1}{#2}[\@xs@Pos@StrCount]% position de l'occurrence ?
+ \ifnum\@xs@Pos@StrCount=\z@% si l'occurrence n'est pas trouvée
+ \advance\Occurrence@StrCount\m@ne% on enlève 1 au compteur
+ \@xs@ReturnResult{\the\Occurrence@StrCount}{#3}% et on renvoie ce résultat
+ \else
+ \@xs@StrCount@i% si l'occurrence est trouvée, on recommence
+ \fi}%
+ \@xs@StrCount@i}
+
+\newcount\Position@StrPosition
+% renvoie la position de l'occurrence #1 de la sous chaine #3 dans la chaine #2
+\newcommand\StrPosition{\@ifstar\@xs@StrPosition@@\@xs@StrPosition@}
+\newcommand\@xs@StrPosition@@[3][1]{%
+ \@xs@expand@and@detokenize{\xsarg@a}{#2}%
+ \@xs@expand@and@detokenize{\xsarg@b}{#3}%
+ \edef\@call{\noexpand\@testopt{\noexpand\@xs@StrPosition[\@xs@expand#1]{\xsarg@a}{\xsarg@b}}{}}%
+ \@call}
+\newcommand\@xs@StrPosition@[3][1]{%
+ \@xs@def\@call{\@xs@expand\@testopt{\@xs@expand\@xs@StrPosition[#1]{#2}{#3}}{}}%
+ \@call}
+\def\@xs@StrPosition[#1]#2#3[#4]{%
+ \Position@StrPosition\z@
+ \ifx\@empty#3\@empty%
+ \else
+ \@xs@StrBefore[#1]{#2}{#3}[\@xs@result@StrPosition]% on extrait la chaine avant l'occurrence de #3
+ \expandafter\@xs@StrLen\expandafter{\@xs@result@StrPosition}[\@xs@len@StrPosition]%
+ \Position@StrPosition\@xs@len@StrPosition%
+ \advance\Position@StrPosition\@ne% \@xs@len@StrPosition+1 est le résultat à priori...
+ \ifnum\@xs@len@StrPosition=\z@% ... mais si la position vaut 0, soit #3 est au début de #2, soit #3 n'est pas trouvé. On lève le doute ci dessous
+ \Position@StrPosition\z@% on considère que l'occurrence de #3 n'est pas trouvée, mais...
+ \ifnum#1=\@ne% si on teste la 1ère occurrence
+ \@xs@IfBeginWith{#2}{#3}% et que le #2 commence par #3,
+ {\Position@StrPosition\@ne}% c'est le seul cas où on renvoie 1
+ {}%
+ \fi
+ \fi
+ \fi
+ \expandafter\@xs@ReturnResult\expandafter{\the\Position@StrPosition}{#4}}
+
+% Définit le délimiteur verb et le développement des arguments par défaut
+\AtBeginDocument{\setverbdelim{|}\fullexpandarg}
+\endinput
+%
+% Historique :
+%
+% 5/7/2008 : premiere sortie de ce package \ No newline at end of file
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 591a9d17df1..55a6c8671ae 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -202,7 +202,7 @@ my @WorkingTLP = qw(
xargs xbase xcolor xdoc xecyr xetex-def xetex-pstricks xetexfontinfo
xetexref xfor xgreek xifthen
xkeyval xltxtra xmpincl xnewcommand xoptarg
- xq xskak xtab xtcapts xunicode xyling xypic-tut-pt xytree
+ xq xskak xstring xtab xtcapts xunicode xyling xypic-tut-pt xytree
york-thesis
ziffer zwgetfdate
);
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index d647163a727..698a1231ca2 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -576,6 +576,7 @@ depend xifthen
depend xmpincl
depend xnewcommand
depend xoptarg
+depend xstring
depend xytree
depend yafoot
depend yplan
diff --git a/Master/tlpkg/tlpsrc/xstring.tlpsrc b/Master/tlpkg/tlpsrc/xstring.tlpsrc
new file mode 100644
index 00000000000..e53475b8c6e
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/xstring.tlpsrc
@@ -0,0 +1,2 @@
+name xstring
+category Package