Char - IsPunctuation
Indicates whether the specified Unicode character is categorized as a punctuation mark.
public static void Main() { char [] input = {'.','N','E','T','4','.','7','.','2'}; Console.WriteLine("Is each of the following characters a punctuation?"); for (int i = 0; i < input.Length; i++) { // C# Extension Method: Char - IsPunctuation var result = input[i].IsPunctuation(); Console.WriteLine("{0} : {1} ", input[i], result); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Indicates whether the specified Unicode character is categorized as a punctuation mark. /// </summary> /// <param name="c">The Unicode character to evaluate.</param> /// <returns>true if is a punctuation mark; otherwise, false.</returns> public static Boolean IsPunctuation(this Char c) { return Char.IsPunctuation(c); } }