String normalize() Method with Example in JavaScript

JavaScript String normalize() Method: Here, we are going to learn about the normalize() method of the string in JavaScript with Example.
Submitted by Shivang Yadav, on February 16, 2020

JavaScript | String normalize() Method

The String.normalize() method in JavaScript is used to find the Unicode normalized form of the string passed as a parameter to the function.

Syntax:

    String.normalize(str);

Parameter(s):

The method accepts only one parameter which indicates which type of normalization is to be found.

The following is the parameter list that shows different forms that are processed,

  • NFC : Normalization form Canonical composition
  • NFKC : Normalization form compatibility composition
  • NFD : Normalization form Canonical decomposition
  • NFKD : Normalization form compatibility decomposition

Return value:

The return type of this method is string which is Unicode normalization is to be found.

Browser support: Chrome, Internet explorer, Mozilla, Safari, Opera mini.

Example:

str = "Hello"
//"Hello"
str.normalize('NFC')
//"Hello"
str.normalize('NFD')
//"Hello"
str.normalize('NFKD')
//"Hello"
str.normalize('NFKC')
//"Hello"

JavaScript String Object Methods »




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.