Char.IsLowSurrogate(字符串,Int32)将在C#方法
C#中的Char.IsLowSurrogate()方法指示字符串中指定位置的Char对象是否为低代理。
语法
以下是语法-
public static bool IsLowSurrogate (string str, int index);
以上,str是一个字符串,而该指数是字符的str中评估的位置。
示例
现在让我们来看看实现Char.IsLowSurrogate()方法的例子-
using System;
public class Demo {
public static void Main(){
string str = new String(new char[] { 'k', 'm', 'g', 't', 'j', 'p', '\uDC00' });
bool res = Char.IsLowSurrogate(str, 6);
if (res)
Console.WriteLine("Contains Low Surrogate value!");
else
Console.WriteLine("Does not contain Low Surrogate value!");
}
}输出结果
这将产生以下输出-
Contains Low Surrogate value!
示例
现在让我们来看另一个示例-
using System;
public class Demo {
public static void Main(){
string str = new String(new char[] { 'k', 'm', 'g', 't', 'j', 'p', '\uDC00' });
bool res = Char.IsLowSurrogate(str, 3);
if (res)
Console.WriteLine("Contains Low Surrogate value!");
else
Console.WriteLine("Does not contain Low Surrogate value!");
}
}输出结果
这将产生以下输出-
Does not contain Low Surrogate value!