String - IsSymbol
Indicates whether the character at the specified position in a specified string is categorized as a symbol character.
public static void Main() { string input = @"EF?+`~!@#$%^&*|"; Console.WriteLine("Is each of the following characters a symbol?"); for (int i = 0; i < input.Length; i++) { // C# Extension Method: String - IsSymbol var result = input.IsSymbol(i); Console.WriteLine("{0} : {1} ", input[i], result); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Indicates whether the character at the specified position in a specified string is categorized as a symbol /// character. /// </summary> /// <param name="s">A string.</param> /// <param name="index">The position of the character to evaluate in .</param> /// <returns>true if the character at position in is a symbol character; otherwise, false.</returns> public static Boolean IsSymbol(this String s, Int32 index) { return Char.IsSymbol(s, index); } }