C# String Normalize(NormalizationForm)
Description
String Normalize(NormalizationForm)
returns a new
string whose textual value is the same as this string, but whose binary representation
is in the specified Unicode normalization form.
Syntax
String.Normalize(NormalizationForm)
has the following syntax.
public string Normalize(
NormalizationForm normalizationForm
)
Parameters
String.Normalize(NormalizationForm)
has the following parameters.
normalizationForm
- A Unicode normalization form.
Returns
String.Normalize(NormalizationForm)
method returns A new string whose textual value is the same as this string, but whose binary
representation is in the normalization form specified by the normalizationForm
parameter.
Example
This example demonstrates the String.Normalize(NormalizationForm) method.
/*ww w . j a va 2 s . c om*/
using System;
using System.Text;
class Sample
{
public static void Main()
{
string s1 = "\u0063\u0301\u0327\u00BE";
string s2 = null;
s2 = s1.Normalize(NormalizationForm.FormC);
Console.WriteLine(s2.IsNormalized(NormalizationForm.FormC));
s2 = s1.Normalize(NormalizationForm.FormD);
Console.WriteLine(s2.IsNormalized(NormalizationForm.FormD));
s2 = s1.Normalize(NormalizationForm.FormKC);
Console.WriteLine(s2.IsNormalized(NormalizationForm.FormKC));
s2 = s1.Normalize(NormalizationForm.FormKD);
Console.WriteLine(s2.IsNormalized(NormalizationForm.FormKD));
}
}
The code above generates the following result.