diff options
author | Florian Dieminger <me@fiji-flo.de> | 2021-02-11 18:20:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 18:20:05 +0100 |
commit | 747e709ad97c5782af29688f52c8105c08d9a323 (patch) | |
tree | dc574a3e876ecc4d2bda6e7d64c2df1a03282f3f /files/ca/web/javascript/reference/global_objects/string/normalize | |
parent | eff3c1a4a064f7d6cf582f0344dc2dd6d8cece6e (diff) | |
parent | 656b8007e3ac28600241104d0eaa210870561395 (diff) | |
download | translated-content-747e709ad97c5782af29688f52c8105c08d9a323.tar.gz translated-content-747e709ad97c5782af29688f52c8105c08d9a323.tar.bz2 translated-content-747e709ad97c5782af29688f52c8105c08d9a323.zip |
Merge pull request #56 from fiji-flo/unslugging-ca
Unslugging ca
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/string/normalize')
-rw-r--r-- | files/ca/web/javascript/reference/global_objects/string/normalize/index.html | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/string/normalize/index.html b/files/ca/web/javascript/reference/global_objects/string/normalize/index.html new file mode 100644 index 0000000000..052e740dfe --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/string/normalize/index.html @@ -0,0 +1,155 @@ +--- +title: String.prototype.normalize() +slug: Web/JavaScript/Reference/Global_Objects/String/normalize +translation_of: Web/JavaScript/Reference/Global_Objects/String/normalize +original_slug: Web/JavaScript/Referencia/Objectes_globals/String/normalize +--- +<div>{{JSRef}}</div> + +<p>El mètode <strong><code>normalize()</code></strong> retorna la Forma Normalitzada en Unicode d'un string donat (si el valor passat no és un string, es convertirà a string primer).</p> + +<h2 id="Sintaxi">Sintaxi</h2> + +<pre class="syntaxbox"><code><var>str</var>.normalize([<var>forma</var>])</code></pre> + +<h3 id="Paràmetres">Paràmetres</h3> + +<dl> + <dt><code>forma</code></dt> + <dd>Una de les opcions <code>"NFC"</code>, <code>"NFD"</code>, <code>"NFKC"</code>, o <code>"NFKD"</code>, que determina quina Forma de Normalització Unicode es farà anar. Si s'omet o es passa {{jsxref("undefined")}} com a paràmetre, s'utilitzarà <code>"NFC"</code> per defecte. + <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="Errors_llençats">Errors llençats</h3> + +<dl> + <dt>{{jsxref("RangeError")}}</dt> + <dd>Es llença un {{jsxref("RangeError")}} si <code>forma</code> no és un dels valors especificats adalt.</dd> +</dl> + +<h2 id="Descripció">Descripció</h2> + +<p>El mètode <code>normalize()</code> retorna la Forma Normalitzada Unicode d'un string. No afecta el propi valor del string passat sino que en retorna un de nou.</p> + +<h2 id="Exemples">Exemples</h2> + +<h3 id="Utilitzar_normalize()">Utilitzar <code>normalize()</code></h3> + +<pre class="brush: js">// String inicial + +// U+1E9B: LLETRA S PETITA DEL LLATÍ AMB UN PUNT A SOBRE +// U+0323: COMBINACIÓ AMB EL PUNT A SOTA +var str = '\u1E9B\u0323'; + + +// Canonically-composed form (NFC) + +// U+1E9B: LLETRA S PETITA DEL LLATÍ AMB UN PUNT A SOBRE +// U+0323: COMBINACIÓ AMB EL PUNT A SOTA +str.normalize('NFC'); // '\u1E9B\u0323' +str.normalize(); // el mateix que a sobre + + +// Canonically-decomposed form (NFD) + +// U+017F: LLETRA S PETITA DEL LLATÍ AMB UN PUNT A SOBRE +// U+0323: COMBINACIÓ AMB EL PUNT A SOTA +// U+0307: COMBINACIÓ AMB EL PUNT A SOBRE +str.normalize('NFD'); // '\u017F\u0323\u0307' + + +// Compatibly-composed (NFKC) + +// U+1E69: LLETRA S PETITA DEL LLATÍ AMB UN PUNT A SOBRE +str.normalize('NFKC'); // '\u1E69' + + +// Compatibly-decomposed (NFKD) + +// U+0073: LLETRA S PETITA DEL LLATÍ +// U+0323: COMBINACIÓ AMB EL PUNT A SOTA +// U+0307: COMBINACIÓ AMB EL PUNT A SOBRE +str.normalize('NFKD'); // '\u0073\u0323\u0307' +</pre> + +<h2 id="Especificacions">Especificacions</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Especificació</th> + <th scope="col">Estat</th> + <th scope="col">Comentaris</th> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-string.prototype.normalize', 'String.prototype.normalize')}}</td> + <td>{{Spec2('ES6')}}</td> + <td>Definició inicial.</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilitat_amb_navegadors">Compatibilitat amb navegadors</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Característica</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Suport bàsic</td> + <td>{{CompatChrome("34")}}</td> + <td>{{CompatGeckoDesktop("31")}}</td> + <td>{{CompatIE("11")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Característica</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Suport bàsic</td> + <td>{{CompatNo}}</td> + <td>{{CompatChrome("34")}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Vegeu_també">Vegeu també</h2> + +<ul> + <li><a href="http://www.unicode.org/reports/tr15/">Annex del Standard Unicode #15, Formes Normalitzades del Unicode</a></li> + <li><a href="http://en.wikipedia.org/wiki/Unicode_equivalence">Equivalències al Unicode</a></li> +</ul> |