C# Char IsSurrogate(Char)
Description
Char IsSurrogate(Char)
indicates whether the specified
character has a surrogate code unit.
Syntax
Char.IsSurrogate(Char)
has the following syntax.
public static bool IsSurrogate(
char c
)
Parameters
Char.IsSurrogate(Char)
has the following parameters.
c
- The Unicode character to evaluate.
Returns
Char.IsSurrogate(Char)
method returns true if c is either a high surrogate or a low surrogate; otherwise, false.
Example
The following example demonstrates the IsSurrogate method.
//from w w w .j a va 2 s .co m
using System;
public class IsSurrogateSample {
public static void Main() {
string str = "\U00010F00"; // Unicode values between 0x10000 and 0x10FFF are represented by two 16-bit "surrogate" characters
Console.WriteLine(Char.IsSurrogate('a')); // Output: "False"
}
}
The code above generates the following result.