From cb9e359a51c3249d8f5157db69d43fd413ddeda6 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:45:12 +0100 Subject: unslug ca: move --- .../global_objects/string/normalize/index.html | 154 +++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 files/ca/web/javascript/reference/global_objects/string/normalize/index.html (limited to 'files/ca/web/javascript/reference/global_objects/string/normalize') 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..7a6bcef500 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/string/normalize/index.html @@ -0,0 +1,154 @@ +--- +title: String.prototype.normalize() +slug: Web/JavaScript/Referencia/Objectes_globals/String/normalize +translation_of: Web/JavaScript/Reference/Global_Objects/String/normalize +--- +
{{JSRef}}
+ +

El mètode normalize() retorna la Forma Normalitzada en Unicode d'un string donat (si el valor passat no és un string, es convertirà a string primer).

+ +

Sintaxi

+ +
str.normalize([forma])
+ +

Paràmetres

+ +
+
forma
+
Una de les opcions "NFC", "NFD", "NFKC", o "NFKD", que determina quina Forma de Normalització Unicode es farà anar. Si s'omet o es passa {{jsxref("undefined")}} com a paràmetre, s'utilitzarà "NFC" per defecte. +
    +
  • NFC — Normalization Form Canonical Composition.
  • +
  • NFD — Normalization Form Canonical Decomposition.
  • +
  • NFKC — Normalization Form Compatibility Composition.
  • +
  • NFKD — Normalization Form Compatibility Decomposition.
  • +
+
+
+ +

Errors llençats

+ +
+
{{jsxref("RangeError")}}
+
Es llença un {{jsxref("RangeError")}} si forma no és un dels valors especificats adalt.
+
+ +

Descripció

+ +

El mètode normalize() retorna la Forma Normalitzada Unicode d'un string. No afecta el propi valor del string passat sino que en retorna un de nou.

+ +

Exemples

+ +

Utilitzar normalize()

+ +
// 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'
+
+ +

Especificacions

+ + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-string.prototype.normalize', 'String.prototype.normalize')}}{{Spec2('ES6')}}Definició inicial.
+ +

Compatibilitat amb navegadors

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("34")}}{{CompatGeckoDesktop("31")}}{{CompatIE("11")}}{{CompatVersionUnknown}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatChrome("34")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +

Vegeu també

+ + -- cgit v1.2.3-54-g00ecf