C# Char IsLowSurrogate(String, Int32)
Description
Char IsLowSurrogate(String, Int32)
indicates whether
the Char object at the specified position in a string is a low surrogate.
Syntax
Char.IsLowSurrogate(String, Int32)
has the following syntax.
public static bool IsLowSurrogate(
string s,
int index
)
Parameters
Char.IsLowSurrogate(String, Int32)
has the following parameters.
s
- A string.index
- The position of the character to evaluate in s.
Returns
Char.IsLowSurrogate(String, Int32)
method returns true if the numeric value of the specified character in the s parameter ranges
from U+DC00 through U+DFFF; otherwise, false.
Example
The following code example demonstrates the IsLowSurrogate method.
/*www. jav a 2 s . co m*/
using System;
class Sample
{
public static void Main()
{
char cHigh = '\uD800';
char cLow = '\uDC00';
string s1 = new String(new char[] {'a', '\uD800', '\uDC00', 'z'});
string divider = String.Concat( Environment.NewLine, new String('-', 70),
Environment.NewLine);
Console.WriteLine("B1) cLow? - {0}", Char.IsLowSurrogate(cLow));
Console.WriteLine("B2) cHigh? - {0}", Char.IsLowSurrogate(cHigh));
Console.WriteLine("B3) s1[0]? - {0}", Char.IsLowSurrogate(s1, 0));
Console.WriteLine("B4) s1[2]? - {0}", Char.IsLowSurrogate(s1, 2));
}
}
The code above generates the following result.