<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://baripedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AString%2FDocumentation</id>
	<title>Module:String/Documentation - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://baripedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AString%2FDocumentation"/>
	<link rel="alternate" type="text/html" href="https://baripedia.org/index.php?title=Module:String/Documentation&amp;action=history"/>
	<updated>2026-04-13T17:43:45Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.38.6</generator>
	<entry>
		<id>https://baripedia.org/index.php?title=Module:String/Documentation&amp;diff=12589&amp;oldid=prev</id>
		<title>Arthur : 1 version</title>
		<link rel="alternate" type="text/html" href="https://baripedia.org/index.php?title=Module:String/Documentation&amp;diff=12589&amp;oldid=prev"/>
		<updated>2014-06-08T15:00:33Z</updated>

		<summary type="html">&lt;p&gt;1 version&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Le module String (un mot [[anglais]] signifiant ''chaîne de caractères'') permet de manipuler des chaînes de caractères.&lt;br /&gt;
&lt;br /&gt;
== Utilisation ==&lt;br /&gt;
&lt;br /&gt;
Fonctions exportables :&lt;br /&gt;
* &amp;lt;code&amp;gt;len&amp;lt;/code&amp;gt; – renvoie le nombre de caractères dans une chaîne, prend en compte les caractères multi-octets (''len'' ou ''length'' signifie ''taille'', ''longueur'')&lt;br /&gt;
* &amp;lt;code&amp;gt;sub&amp;lt;/code&amp;gt; – renvoie une partie de la chaîne de caractères (''sub'' ou ''sub-string'' signifie ''sous-chaîne'')&lt;br /&gt;
&lt;br /&gt;
Autres fonctions : &amp;lt;br/&amp;gt;&lt;br /&gt;
À compléter…&lt;br /&gt;
&lt;br /&gt;
Modules externes et autres éléments dont ce module a besoin pour fonctionner : &amp;lt;br/&amp;gt;&lt;br /&gt;
À compléter…&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== len ===&lt;br /&gt;
&lt;br /&gt;
This function returns the length of the target string.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|len|target_string|}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
OR&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|len|s=target_string}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
*s: The string whose length to report&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from the target string.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== sub ===&lt;br /&gt;
&lt;br /&gt;
This function returns a substring of the target string at specified indices.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|sub|target_string|start_index|end_index}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
OR&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
*s: The string to return a subset of&lt;br /&gt;
*i: The fist index of the substring to return, defaults to 1.&lt;br /&gt;
*j: The last index of the string to return, defaults to the last character.&lt;br /&gt;
    &lt;br /&gt;
The first character of the string is assigned an index of 1.  If either i or j&lt;br /&gt;
is a negative value, it is interpreted the same as selecting a character by &lt;br /&gt;
counting from the end of the string.  Hence, a value of -1 is the same as &lt;br /&gt;
selecting the last character of the string.&lt;br /&gt;
&lt;br /&gt;
If the requested indices are out of range for the given string, an error is &lt;br /&gt;
reported.&lt;br /&gt;
&lt;br /&gt;
=== match ===&lt;br /&gt;
&lt;br /&gt;
This function returns a substring from the source string that matches a &lt;br /&gt;
specified pattern.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
OR&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|pos|s=source_string|pattern=pattern_string|start=start_index&lt;br /&gt;
    |match=match_number|plain=plain_flag|nomatch=nomatch_output}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
*s: The string to search&lt;br /&gt;
*pattern: The pattern or string to find within the string&lt;br /&gt;
*start: The index within the source string to start the search.  The first character of the string has index 1.  Defaults to 1.&lt;br /&gt;
*match: In some cases it may be possible to make multiple matches on a single string.  This specifies which match to return, where the first match is match= 1.  If a negative number is specified then a match is returned counting from the last match.  Hence match = -1 is the same as requesting the last match.  Defaults to 1.&lt;br /&gt;
*plain: A flag indicating that the pattern should be understood as plain text.  Defaults to false.&lt;br /&gt;
*nomatch: If no match is found, output the &amp;quot;nomatch&amp;quot; value rather than an error.&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from each string.  In some circumstances this is desirable, in &lt;br /&gt;
other cases one may want to preserve the whitespace.&lt;br /&gt;
&lt;br /&gt;
If the match_number or start_index are out of range for the string being queried, then&lt;br /&gt;
this function generates an error.  An error is also generated if no match is found.&lt;br /&gt;
If one adds the parameter ignore_errors=true, then the error will be suppressed and &lt;br /&gt;
an empty string will be returned on any failure.&lt;br /&gt;
&lt;br /&gt;
For information on constructing Lua patterns, a form of [regular expression], see:&lt;br /&gt;
&lt;br /&gt;
* http://www.lua.org/manual/5.1/manual.html#5.4.1&lt;br /&gt;
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns&lt;br /&gt;
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== pos ===&lt;br /&gt;
&lt;br /&gt;
This function returns a single character from the target string at position pos.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|pos|target_string|index_value}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
OR&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|pos|target=target_string|pos=index_value}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
*target: The string to search&lt;br /&gt;
*pos: The index for the character to return&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from the target string.  In some circumstances this is desirable, in &lt;br /&gt;
other cases one may want to preserve the whitespace.&lt;br /&gt;
&lt;br /&gt;
The first character has an index value of 1.&lt;br /&gt;
&lt;br /&gt;
If one requests a negative value, this function will select a character by counting backwards &lt;br /&gt;
from the end of the string.  In other words pos = -1 is the same as asking for the last character.&lt;br /&gt;
&lt;br /&gt;
A requested value of zero, or a value greater than the length of the string returns an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== str_find ===&lt;br /&gt;
&lt;br /&gt;
This function duplicates the behavior of {{str_find}}, including all of its quirks.&lt;br /&gt;
This is provided in order to support existing templates, but is NOT RECOMMENDED for &lt;br /&gt;
new code and templates.  New code is recommended to use the &amp;quot;find&amp;quot; function instead.&lt;br /&gt;
&lt;br /&gt;
Returns the first index in &amp;quot;source&amp;quot; that is a match to &amp;quot;target&amp;quot;.  Indexing is 1-based,&lt;br /&gt;
and the function returns -1 if the &amp;quot;target&amp;quot; string is not present in &amp;quot;source&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Important Note: If the &amp;quot;target&amp;quot; string is empty / missing, this function returns a&lt;br /&gt;
value of &amp;quot;1&amp;quot;, which is generally unexpected behavior, and must be accounted for&lt;br /&gt;
separatetly.&lt;br /&gt;
&lt;br /&gt;
=== find ===&lt;br /&gt;
&lt;br /&gt;
This function allows one to search for a target string or pattern within another&lt;br /&gt;
string.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
OR&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
*source: The string to search&lt;br /&gt;
*target: The string or pattern to find within source&lt;br /&gt;
*start: The index within the source string to start the search, defaults to 1&lt;br /&gt;
*plain: Boolean flag indicating that target should be understood as plain text and not as a Lua style regular expression, defaults to true&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from the parameter.  In some circumstances this is desirable, in &lt;br /&gt;
other cases one may want to preserve the whitespace.&lt;br /&gt;
&lt;br /&gt;
This function returns the first index &amp;gt;= &amp;quot;start&amp;quot; where &amp;quot;target&amp;quot; can be found &lt;br /&gt;
within &amp;quot;source&amp;quot;.  Indices are 1-based.  If &amp;quot;target&amp;quot; is not found, then this &lt;br /&gt;
function returns 0.  If either &amp;quot;source&amp;quot; or &amp;quot;target&amp;quot; are missing / empty, this&lt;br /&gt;
function also returns 0.&lt;br /&gt;
&lt;br /&gt;
This function should be safe for UTF-8 strings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== replace ===&lt;br /&gt;
&lt;br /&gt;
This function allows one to replace a target string or pattern within another&lt;br /&gt;
string.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
OR&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|&lt;br /&gt;
   count=replacement_count|plain=plain_flag}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
*source: The string to search&lt;br /&gt;
*pattern: The string or pattern to find within source&lt;br /&gt;
*replace: The replacement text&lt;br /&gt;
*count: The number of occurences to replace, defaults to all.&lt;br /&gt;
*plain: Boolean flag indicating that pattern should be understood as plain text and not as a Lua style regular expression, defaults to true &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== simpletitle ===&lt;br /&gt;
&lt;br /&gt;
This function returns the current page title without the homonymy part (the part in parenthesis).&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|simpletitle}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
OR&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|simpletitle|string}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
*string: if present this function will treat this string as the title of the page and remove&lt;br /&gt;
homonymy part if present in it. If not given the function uses the page title (without namespace)&lt;br /&gt;
&lt;br /&gt;
=== titledisambig ===&lt;br /&gt;
&lt;br /&gt;
Cette fonction renvoie la partie entre parenthèses du titre utilisée pour résoudre les cas d'homonymie.&lt;br /&gt;
&lt;br /&gt;
Utilisation :&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|titledisambig}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
OU&lt;br /&gt;
&amp;lt;pre&amp;gt;{{#invoke:String|titledisambig|expression}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paramètres :&lt;br /&gt;
* expression : si ce paramètre est présent, la fonction l'utilisera comme titre plutôt que de prendre le titre de la page.&lt;br /&gt;
&lt;br /&gt;
== Exemples ==&lt;br /&gt;
&lt;br /&gt;
===len===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke:String|len|ABCDEFGHIJ}}           renvoie 10&lt;br /&gt;
{{#invoke:String|len|É}}                    renvoie 1, même si É occupe 2 octets&lt;br /&gt;
{{#invoke:String|len| }}                    renvoie 1, les espaces blancs sont pris en compte&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===sub===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|0}}          renvoie une erreur, ici l'index commence à 1 (contrairement à d'autres langages de programmation)&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|5}}          renvoie EFGHIJ, on commence à partir du 5ème caractère et on prend le reste&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|1|3}}        renvoie ABC, on commence à partir du 1er jusqu'au 3ème&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|1|1}}        renvoie A&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|-1}}         renvoie J, l'index est inversé on commence à la fin&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|-5|-2}}      renvoie FGHI&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|-5|2}}       renvoie une erreur, l'index de fin doit être après l'index de début (2 est placé avant -5) &lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|-5|7}}       renvoie FGHI, l'index de fin est bien après l'index de début&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{traduction/référence|en|Module:String/doc}}&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
{{Projet Scribunto}}&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Catégorie:Documentation de module|{{BASEPAGENAME}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arthur</name></author>
	</entry>
	<entry>
		<id>https://baripedia.org/index.php?title=Module:String/Documentation&amp;diff=7813&amp;oldid=prev</id>
		<title>Arthur : 1 version</title>
		<link rel="alternate" type="text/html" href="https://baripedia.org/index.php?title=Module:String/Documentation&amp;diff=7813&amp;oldid=prev"/>
		<updated>2014-01-13T22:02:23Z</updated>

		<summary type="html">&lt;p&gt;1 version&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Le module String (un mot [[anglais]] signifiant ''chaîne de caractères'') permet de manipuler des chaînes de caractères.&lt;br /&gt;
&lt;br /&gt;
== Utilisation ==&lt;br /&gt;
&lt;br /&gt;
Fonctions exportables :&lt;br /&gt;
* &amp;lt;code&amp;gt;len&amp;lt;/code&amp;gt; – renvoie le nombre de caractères dans une chaîne, prend en compte les caractères multi-octets (''len'' ou ''length'' signifie ''taille'', ''longueur'')&lt;br /&gt;
* &amp;lt;code&amp;gt;sub&amp;lt;/code&amp;gt; – renvoie une partie de la chaîne de caractères (''sub'' ou ''sub-string'' signifie ''sous-chaîne'')&lt;br /&gt;
&lt;br /&gt;
Autres fonctions : &amp;lt;br/&amp;gt;&lt;br /&gt;
À compléter…&lt;br /&gt;
&lt;br /&gt;
Modules externes et autres éléments dont ce module a besoin pour fonctionner : &amp;lt;br/&amp;gt;&lt;br /&gt;
À compléter…&lt;br /&gt;
&lt;br /&gt;
== Exemples ==&lt;br /&gt;
&lt;br /&gt;
===len===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke:String|len|ABCDEFGHIJ}}           renvoie 10&lt;br /&gt;
{{#invoke:String|len|É}}                    renvoie 1, même si É occupe 2 octets&lt;br /&gt;
{{#invoke:String|len| }}                    renvoie 1, les espaces blancs sont pris en compte&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===sub===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|0}}          renvoie une erreur, ici l'index commence à 1 (contrairement à d'autres langages de programmation)&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|5}}          renvoie EFGHIJ, on commence à partir du 5ème caractère et on prend le reste&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|1|3}}        renvoie ABC, on commence à partir du 1er jusqu'au 3ème&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|1|1}}        renvoie A&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|-1}}         renvoie J, l'index est inversé on commence à la fin&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|-5|-2}}      renvoie FGHI&lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|-5|2}}       renvoie une erreur, l'index de fin doit être après l'index de début (2 est placé avant -5) &lt;br /&gt;
{{#invoke:String|sub|ABCDEFGHIJ|-5|7}}       renvoie FGHI, l'index de fin est bien après l'index de début&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
{{Projet Scribunto}}&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Catégorie:Documentation de module|{{BASEPAGENAME}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arthur</name></author>
	</entry>
</feed>