Directory macros/generic/xstring
README
_________________
xstring package
v 1.86
2023/08/22
_________________
This package provides macros manipulating strings for programming use.
A "string" is made of TeX code, i.e. chars (catcodes 10, 11 and 12), controls
sequences, groups between braces, tokens with other catcodes, excepted catcodes
6 and 14 (usually chars # and %).
Main features are:
* tests:
- does a string contains at least n times an another?
- does a string starts (or ends) with another? etc.
- is a string an integer? A decimal?
- are 2 strings equal?
- is a string equal to several cases?
* 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;
- split a string;
- find a group with its identifier, etc.
* substitution of all (or the n first) occurrences of a substring
for an other substring;
* n times expansion of the tokens of a string;
* calculation of numbers:
- length of a string;
- position of the nth occurrence of a substring;
- how many times a string contains a substring?
- comparison of strings: position of the first difference;
- identifier of the group in which a macro worked.
For advanced programming needs, other macros allow to use other special
characters forbiden in strings (# %).
This bundle contains 7 files:
* xstring.sty (the sty file for LaTeX)
* xstring.tex (the package itself)
* xstring_doc_en.tex and xstring_doc_en.pdf (manual in english)
* xstring_doc_fr.tex and xstring_doc_fr.pdf (manual in french))
* README (this file)
##############################################################################
##############################################################################
Cette extension regroupe un ensemble de macros manipulant des chaînes à des
fins de programmation.
Une "chaîne" est du code TeX, c'est-à-dire des caractères (catcodes 10, 11
et 12), des séquences de contrôle, des groupes entre accolades et des lexèmes
ayant d'autres catcodes excepté les catcodes 6 et 14 (habituellement les
caractères # et %).
Les principales fonctionnalités sont :
* 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.
- une chaîne est-elle un entier relatif ? Un décimal ?
- deux chaînes sont-elles égales ?
- une chaîne est elle égale à plusieurs cas ?
* 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;
- coupure d'une chaîne;
- recherche d'un groupe avec son identifiant.
* le remplacement de toutes ou des n premières occurrences d'une
sous-chaîne par une autre sous-chaîne;
* n-développement des tokens d'une 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;
- comparaison de 2 chaînes : position de la 1ere différence;
- identifiant du groupe dans lequel les macros ont opéré.
Pour des méthodes de programmation avancées, d'autres commandes permettent
d'utiliser les caractères spéciaux interdits dans les chaines (# %).
Christian Tellechea
<unbonpetit@netc.fr>
Download the contents of this package in one zip archive (654.9k).
xstring – String manipulation for (La)TeX
The package provides macros for manipulating strings — testing a string’s contents, extracting substrings, substitution of substrings and providing numbers such as string length, position of, or number of recurrences of, a substring.
The package works equally in Plain TeX and LaTeX (though e-TeX is always required). The strings to be processed may contain (expandable) macros.
| Package | xstring |
| Version | 1.86 |
| Licenses | The LaTeX Project Public License 1.3c |
| Copyright | 2008–2023 Christian Tellechea |
| Maintainer | Christian Tellechea |
| Contained in | TeX Live as xstring MiKTeX as xstring |
| Topics | String |