diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex | 348 |
1 files changed, 200 insertions, 148 deletions
diff --git a/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex b/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex index 0e77624f27e..44961af495b 100644 --- a/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex +++ b/Master/texmf-dist/doc/latex/xstring/xstring_doc_en.tex @@ -1,5 +1,19 @@ +% This is xtring_doc_en.tex, the manual of xstring +% 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{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} @@ -12,27 +26,12 @@ \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}% +\newcommand*\exemple{\@ifstar{\def\frontiere{|}\@xs@MakeVerb}{\def\frontiere{}\@xs@MakeVerb}} +\def\@xs@afterreadverb#1{% + \normalexpandarg + \tokenize\cs@resultat{#1}% + \fullexpandarg + \hbox to\linewidth{\hbox to0.7\linewidth{\hfil\tt#1}\quad\frontiere\cs@resultat\frontiere\hfil}\par} \makeatother \newcommand\guill[1]{"#1"} \newcommand\argu[1]{$\langle$\textit{#1}$\rangle$} @@ -53,15 +52,14 @@ \renewcommand\th{${}^\text{th}$} \begin{document} -\gdef\Partage{0.7} -\setlength{\parindent}{0cm} +\setlength{\parindent}{0pt} \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} + \small v\xstringversion\par\vspace{25pt} \normalsize User's manual \end{center} \end{minipage} @@ -70,20 +68,21 @@ \begin{center} Christian {\sc Tellechea}\par\small \href{mailto:unbonpetit@gmail.com}{\nolinkurl{unbonpetit@gmail.com}}\par\vspace{5pt} - July 6\th{} 2008 + \xstringenglishdate \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: + This package which requires $\varepsilon-\TeX{}$ 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. + \item is a string an integer? A decimal? \end{itemize} \item[$\triangleright$] extractions of substrings: \begin{itemize} @@ -99,6 +98,7 @@ \item how many times a string contains a substring? \end{itemize} \end{itemize} + \setlength{\parindent}{0pt} \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} @@ -112,7 +112,7 @@ 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 +This extension\footnote{This extension does not require \LaTeX{} and can be compiled with Plain $\varepsilon$-\TeX{}.} 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. @@ -212,13 +212,13 @@ Tests if \argu{string} contains at least \argu{number} times \argu{stringA} and \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}| +\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} @@ -234,15 +234,15 @@ In \argu{string}, tests if the \argu{number1}\th{} occurrence of \argu{stringA} \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}| +\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} @@ -259,15 +259,15 @@ In \argu{string}, tests if the \argu{number1}\th{} occurrence of \argu{stringA} \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}| +\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} @@ -280,10 +280,10 @@ Tests if \argu{string} begins with \argu{stringA}, and runs \argu{true} if so, a \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}| +\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} @@ -296,10 +296,62 @@ Tests if \argu{string} ends with \argu{stringA}, and runs \argu{true} if so, and \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}| +\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}| + +\subsubsection{IfInteger} + +\verb|\IfInteger|\ARGU{number}\ARGU{true}\ARGU{false} +\smallskip + +Tests if \argu{nombre} is an integer, and runs \argu{true} if so, and \argu{false} otherwise.\smallskip + +If test is false because unexpected characters, the control sequence \verb|\@xs@afterinteger| contains the illegal part of \argu{number}.\medskip + +\exemple|\IfInteger{13}{true}{false}| +\exemple|\IfInteger{-219}{true}{false}| +\exemple|\IfInteger{+9}{true}{false}| +\exemple|\IfInteger{3.14}{true}{false}| +\exemple|\IfInteger{0}{true}{false}| +\exemple|\IfInteger{49a}{true}{false}| +\exemple|\IfInteger{+}{true}{false}| +\exemple|\IfInteger{-}{true}{false}| +\exemple|\IfInteger{0000}{true}{false}| + +\subsubsection{IfDecimal} + + +\verb|\IfInteger|\ARGU{number}\ARGU{true}\ARGU{false} +\smallskip + +Tests if \argu{number} is a decimal, and runs \argu{true} if so, and \argu{false} otherwise.\smallskip + +Counters \verb|\integerpart| and \verb|\decimalpart| contain the integer part and decimal part of \argu{number}. + +If test is false because unexpected characters, the control sequence \verb|\@xs@afterdecimal| contains the illegal part of \argu{number}, whereas if test is false because decimal part is empty after decimal separator, it contains ''X``.\medskip + +\begin{Conditions} + \item Decimal separator can be a dot or a comma; + \item If what is on the right of decimal separator (if it exists) is empty, the test is false; + \item If what is on the left of decimal separator (if it exists) is empty, the integer part is assumed to be 0; +\end{Conditions} + +\exemple|\IfDecimal{3.14}{vrai}{faux}| +\exemple|\IfDecimal{3,14}{vrai}{faux}| +\exemple|\IfDecimal{-0.5}{vrai}{faux}| +\exemple|\IfDecimal{.7}{vrai}{faux}| +\exemple|\IfDecimal{,9}{vrai}{faux}| +\exemple|\IfDecimal{1..2}{vrai}{faux}| +\exemple|\IfDecimal{+6}{vrai}{faux}| +\exemple|\IfDecimal{-15}{vrai}{faux}| +\exemple|\IfDecimal{1.}{vrai}{faux}| +\exemple|\IfDecimal{2,}{vrai}{faux}| +\exemple|\IfDecimal{.}{vrai}{faux}| +\exemple|\IfDecimal{,}{vrai}{faux}| +\exemple|\IfDecimal{+}{vrai}{faux}| +\exemple|\IfDecimal{-}{vrai}{faux}| \subsection{Extraction of substrings} \subsubsection{StrBefore} @@ -317,14 +369,14 @@ In \argu{string}, returns what is leftwards the \argu{number}\th{} occurrence of \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}| +\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} @@ -342,15 +394,15 @@ In \argu{string}, returns what is rightwards the \argu{number}\th{} occurrence o \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}| +\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} @@ -367,16 +419,16 @@ In \argu{string}, returns the substring between\footnote{In a strict sense, i.e. \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}| +\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} @@ -395,16 +447,16 @@ In \argu{string}, substitute the \argu{number} first occurrences of \argu{string \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}| +\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} @@ -422,11 +474,11 @@ Delete the \argu{number} first occurrences of \argu{stringA} in \argu{string}, e \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 }{ }| +\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} @@ -441,11 +493,11 @@ In \argu{string}, delete the \argu{number} fisrt characters on the left.\medskip \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}| +\exemple*|\StrGobbleLeft{xstring}{2}| +\exemple*|\StrGobbleLeft{xstring}{9}| +\exemple*|\StrGobbleLeft{LaTeX}{4}| +\exemple*|\StrGobbleLeft{LaTeX}{-2}| +\exemple*|\StrGobbleLeft{a bc def }{4}| \subsubsection{StrLeft} @@ -460,11 +512,11 @@ In \argu{string}, returns the \argu{number} fisrt characters on the left.\medski \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}| +\exemple*|\StrLeft{xstring}{2}| +\exemple*|\StrLeft{xstring}{9}| +\exemple*|\StrLeft{LaTeX}{4}| +\exemple*|\StrLeft{LaTeX}{-2}| +\exemple*|\StrLeft{a bc def }{5}| \subsubsection{StrGobbleRight} @@ -473,11 +525,11 @@ In \argu{string}, returns the \argu{number} fisrt characters on the left.\medski 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}| +\exemple*|\StrGobbleRight{xstring}{2}| +\exemple*|\StrGobbleRight{xstring}{9}| +\exemple*|\StrGobbleRight{LaTeX}{4}| +\exemple*|\StrGobbleRight{LaTeX}{-2}| +\exemple*|\StrGobbleRight{a bc def }{4}| \subsubsection{StrRight} @@ -486,11 +538,11 @@ In \argu{string}, delete the \argu{number} last characters on the right.\medskip 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}| +\exemple*|\StrRight{xstring}{2}| +\exemple*|\StrRight{xstring}{9}| +\exemple*|\StrRight{LaTeX}{4}| +\exemple*|\StrRight{LaTeX}{-2}| +\exemple*|\StrRight{a bc def }{5}| \subsubsection{StrChar} @@ -504,10 +556,10 @@ Returns the character at the position \argu{number} in \argu{string}.\medskip \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}| +\exemple|\StrChar{xstring}{4}| +\exemple*|\StrChar{xstring}{9}| +\exemple*|\StrChar{xstring}{-5}| +\exemple|\StrChar{a bc def }{6}| \subsubsection{StrMid} @@ -525,12 +577,12 @@ In \argu{string}, returns the substring between\footnote{In the broad sense, i.e \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}| +\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} @@ -540,9 +592,9 @@ In \argu{string}, returns the substring between\footnote{In the broad sense, i.e Return the length of \argu{string}. -\Exemple|\StrLen{xstring}| -\Exemple|\StrLen{A}| -\Exemple|\StrLen{a bc def }| +\exemple|\StrLen{xstring}| +\exemple|\StrLen{A}| +\exemple|\StrLen{a bc def }| \subsubsection{StrCount} @@ -555,10 +607,10 @@ Counts how many times \argu{stringA} is contained in \argu{string}.\par\medskip \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}| +\exemple|\StrCount{abracadabra}{a}| +\exemple|\StrCount{abracadabra}{bra}| +\exemple|\StrCount{abracadabra}{tic}| +\exemple|\StrCount{aaaaaa}{aa}| \subsubsection{StrPosition} @@ -575,13 +627,13 @@ In \argu{string}, returns the position of the \argu{number}\th{} occurrence of \ \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}| +\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} @@ -626,7 +678,7 @@ The reverse process of what has been seen above is to transform a \texte{10,11,1 \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 +\argu{control sequence} is fully expanded if \verb|\fullexpandarg| has been called (see page~\pageref{devarg}), and is not expanded 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} |