diff options
| author | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-09-04 00:46:12 +0900 |
|---|---|---|
| committer | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-09-04 00:46:12 +0900 |
| commit | fe6f6abf2b7c497bf1f97f73a82dde7cf48eb79f (patch) | |
| tree | 51b7edfc370236684a203f4e69ae67bb7d24b549 /files/fr/web/javascript/reference/global_objects/string/normalize | |
| parent | 04ea4edc83cc12142ed151bbea2c65cffc8e76f6 (diff) | |
| parent | eeb07fe338cdc90092841d717919f46f9d9e3ff9 (diff) | |
| download | translated-content-fe6f6abf2b7c497bf1f97f73a82dde7cf48eb79f.tar.gz translated-content-fe6f6abf2b7c497bf1f97f73a82dde7cf48eb79f.tar.bz2 translated-content-fe6f6abf2b7c497bf1f97f73a82dde7cf48eb79f.zip | |
Merge branch 'main' into 20210818-Glossary/Type
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/string/normalize')
| -rw-r--r-- | files/fr/web/javascript/reference/global_objects/string/normalize/index.html | 124 | ||||
| -rw-r--r-- | files/fr/web/javascript/reference/global_objects/string/normalize/index.md | 103 |
2 files changed, 103 insertions, 124 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/string/normalize/index.html b/files/fr/web/javascript/reference/global_objects/string/normalize/index.html deleted file mode 100644 index b35ff15f8b..0000000000 --- a/files/fr/web/javascript/reference/global_objects/string/normalize/index.html +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: String.prototype.normalize() -slug: Web/JavaScript/Reference/Global_Objects/String/normalize -tags: - - ECMAScript 2015 - - JavaScript - - Méthode - - Prototype - - Reference - - String - - Unicode -translation_of: Web/JavaScript/Reference/Global_Objects/String/normalize -original_slug: Web/JavaScript/Reference/Objets_globaux/String/normalize ---- -<div>{{JSRef}}</div> - -<p>La méthode <code><strong>normalize()</strong></code> permet de renvoyer la forme normalisée Unicode d'une chaîne de caractères (si la valeur n'est pas une chaîne de caractères, elle sera convertie).</p> - -<div>{{EmbedInteractiveExample("pages/js/string-normalize.html")}}</div> - -<h2 id="Syntaxe">Syntaxe</h2> - -<pre class="syntaxbox"><var>str</var>.normalize([<var>form</var>]);</pre> - -<h3 id="Paramètres">Paramètres</h3> - -<dl> - <dt><code>form</code></dt> - <dd>Paramètre optionnel. Une chaîne parmi "NFC", "NFD", "NFKC", ou "NFKD", définissant la forme de normalisation Unicode à utiliser. Si le paramètre n'est pas précisé ou vaut {{jsxref("undefined")}}, la valeur par défaut utilisée sera "<code>NFC</code>". - <ul> - <li><code>NFC</code> - Normalization Form Canonical Composition.</li> - <li><code>NFD</code> - Normalization Form Canonical Decomposition.</li> - <li><code>NFKC</code> - Normalization Form Compatibility Composition.</li> - <li><code>NFKD</code> - Normalization Form Compatibility Decomposition.</li> - </ul> - </dd> -</dl> - -<h3 id="Valeur_de_retour">Valeur de retour</h3> - -<p>Une chaîne de caractères qui est le forme Unicode normalisée de la chaîne appelante.</p> - -<h3 id="Exceptions">Exceptions</h3> - -<dl> - <dt>{{jsxref("RangeError")}}</dt> - <dd>Une exception <code>RangeError</code> est envoyée si le paramètre <code>form</code> n'est pas une des valeurs définies ci-avant.</dd> -</dl> - -<h2 id="Description">Description</h2> - -<p>La méthode <code>normalize()</code> renvoie la forme normalisée Unicode de la chaîne de caractères. Elle n'affecte pas la valeur de la chaîne.</p> - -<h2 id="Exemples">Exemples</h2> - -<pre class="brush:js;">// Chaîne initiale - -// U+1E9B: LATIN SMALL LETTER LONG S WITH DOT ABOVE -// U+0323: COMBINING DOT BELOW -var str = "\u1E9B\u0323"; - - -// Forme canonique composée (Canonically-composed form) (NFC) - -// U+1E9B: LATIN SMALL LETTER LONG S WITH DOT ABOVE -// U+0323: COMBINING DOT BELOW -str.normalize("NFC"); // "\u1E9B\u0323" -str.normalize(); // la même chaîne que précédemment - - -// Forme canonique décomposée (Canonically-decomposed form) (NFD) - -// U+017F: LATIN SMALL LETTER LONG S -// U+0323: COMBINING DOT BELOW -// U+0307: COMBINING DOT ABOVE -str.normalize("NFD"); // "\u017F\u0323\u0307" - - -// Forme composée compatible (NFKC) - -// U+1E69: LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE -str.normalize("NFKC"); // "\u1E69" - - -// Forme décomposée compatible (NFKD) - -// U+0073: LATIN SMALL LETTER S -// U+0323: COMBINING DOT BELOW -// U+0307: COMBINING DOT ABOVE -str.normalize("NFKD"); // "\u0073\u0323\u0307" -</pre> - -<h2 id="Spécifications">Spécifications</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Spécification</th> - <th scope="col">État</th> - <th scope="col">Commentaires</th> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-string.prototype.normalize', 'String.prototype.normalize')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Définition initiale.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-string.prototype.normalize', 'String.prototype.normalize')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<p>{{Compat("javascript.builtins.String.normalize")}}</p> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li><a href="https://www.unicode.org/reports/tr15/">Formes de normalisation Unicode, Annexe n°15 du standard Unicode</a></li> - <li><a href="https://en.wikipedia.org/wiki/Unicode_equivalence">Équivalence Unicode</a></li> -</ul> diff --git a/files/fr/web/javascript/reference/global_objects/string/normalize/index.md b/files/fr/web/javascript/reference/global_objects/string/normalize/index.md new file mode 100644 index 0000000000..c3c1818ded --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/string/normalize/index.md @@ -0,0 +1,103 @@ +--- +title: String.prototype.normalize() +slug: Web/JavaScript/Reference/Global_Objects/String/normalize +tags: + - ECMAScript 2015 + - JavaScript + - Méthode + - Prototype + - Reference + - String + - Unicode +translation_of: Web/JavaScript/Reference/Global_Objects/String/normalize +original_slug: Web/JavaScript/Reference/Objets_globaux/String/normalize +--- +{{JSRef}} + +La méthode **`normalize()`** permet de renvoyer la forme normalisée Unicode d'une chaîne de caractères (si la valeur n'est pas une chaîne de caractères, elle sera convertie). + +{{EmbedInteractiveExample("pages/js/string-normalize.html")}} + +## Syntaxe + + str.normalize([form]); + +### Paramètres + +- `form` + + - : Paramètre optionnel. Une chaîne parmi "NFC", "NFD", "NFKC", ou "NFKD", définissant la forme de normalisation Unicode à utiliser. Si le paramètre n'est pas précisé ou vaut {{jsxref("undefined")}}, la valeur par défaut utilisée sera "`NFC`". + + - `NFC` - Normalization Form Canonical Composition. + - `NFD` - Normalization Form Canonical Decomposition. + - `NFKC` - Normalization Form Compatibility Composition. + - `NFKD` - Normalization Form Compatibility Decomposition. + +### Valeur de retour + +Une chaîne de caractères qui est le forme Unicode normalisée de la chaîne appelante. + +### Exceptions + +- {{jsxref("RangeError")}} + - : Une exception `RangeError` est envoyée si le paramètre `form` n'est pas une des valeurs définies ci-avant. + +## Description + +La méthode `normalize()` renvoie la forme normalisée Unicode de la chaîne de caractères. Elle n'affecte pas la valeur de la chaîne. + +## Exemples + +```js +// Chaîne initiale + +// U+1E9B: LATIN SMALL LETTER LONG S WITH DOT ABOVE +// U+0323: COMBINING DOT BELOW +var str = "\u1E9B\u0323"; + + +// Forme canonique composée (Canonically-composed form) (NFC) + +// U+1E9B: LATIN SMALL LETTER LONG S WITH DOT ABOVE +// U+0323: COMBINING DOT BELOW +str.normalize("NFC"); // "\u1E9B\u0323" +str.normalize(); // la même chaîne que précédemment + + +// Forme canonique décomposée (Canonically-decomposed form) (NFD) + +// U+017F: LATIN SMALL LETTER LONG S +// U+0323: COMBINING DOT BELOW +// U+0307: COMBINING DOT ABOVE +str.normalize("NFD"); // "\u017F\u0323\u0307" + + +// Forme composée compatible (NFKC) + +// U+1E69: LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE +str.normalize("NFKC"); // "\u1E69" + + +// Forme décomposée compatible (NFKD) + +// U+0073: LATIN SMALL LETTER S +// U+0323: COMBINING DOT BELOW +// U+0307: COMBINING DOT ABOVE +str.normalize("NFKD"); // "\u0073\u0323\u0307" +``` + +## Spécifications + +| Spécification | État | Commentaires | +| -------------------------------------------------------------------------------------------------------------------- | ---------------------------- | -------------------- | +| {{SpecName('ES2015', '#sec-string.prototype.normalize', 'String.prototype.normalize')}} | {{Spec2('ES2015')}} | Définition initiale. | +| {{SpecName('ESDraft', '#sec-string.prototype.normalize', 'String.prototype.normalize')}} | {{Spec2('ESDraft')}} | | + +## Compatibilité des navigateurs + +{{Compat("javascript.builtins.String.normalize")}} + +## Voir aussi + +- [Formes de normalisation Unicode, Annexe n°15 du standard Unicode](https://www.unicode.org/reports/tr15/) +- [Équivalence Unicode](https://en.wikipedia.org/wiki/Unicode_equivalence) |
