summaryrefslogtreecommitdiff
path: root/macros/generic/xstring/README
blob: 8234833cb98c95d72ee0cdfcc158d9488f928c35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
                              _________________

                               xstring package
                                   v 1.83
                                 2019/02/06
                              _________________

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>