要检查Unicode字符是否为分隔符,代码如下-
using System; public class Demo { public static void Main(){ bool res; char val = ','; Console.WriteLine("Value = "+val); res = Char.IsSeparator(val); Console.WriteLine("Is the value a separator? = "+res); } }
输出结果
这将产生以下输出-
Value = , Is the value a separator? = False
现在让我们来看另一个示例-
using System; public class Demo { public static void Main(){ bool res; char val = ' '; Console.WriteLine("Value = "+val); res = Char.IsSeparator(val); Console.WriteLine("Is the value a separator? = "+res); } }
输出结果
这将产生以下输出-
Value = Is the value a separator? = True