Export (0) Print
Expand All

Char.IsWhiteSpace Method (Char)

Indicates whether the specified Unicode character is categorized as white space.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public static bool IsWhiteSpace(
	char c
)

Parameters

c
Type: System.Char

The Unicode character to evaluate.

Return Value

Type: System.Boolean
true if c is white space; otherwise, false.

White space characters are the following Unicode characters:

  • Members of the SpaceSeparator category, which includes the characters SPACE (U+0020), NO-BREAK SPACE (U+00A0), OGHAM SPACE MARK (U+1680), EN QUAD (U+2000), EM QUAD (U+2001), EN SPACE (U+2002), EM SPACE (U+2003), THREE-PER-EM SPACE (U+2004), FOUR-PER-EM SPACE (U+2005), SIX-PER-EM SPACE (U+2006), FIGURE SPACE (U+2007), PUNCTUATION SPACE (U+2008), THIN SPACE (U+2009), HAIR SPACE (U+200A), NARROW NO-BREAK SPACE (U+202F), MEDIUM MATHEMATICAL SPACE (U+205F), and IDEOGRAPHIC SPACE (U+3000).

  • Members of the LineSeparator category, which consists solely of the LINE SEPARATOR character (U+2028).

  • Members of the ParagraphSeparator category, which consists solely of the PARAGRAPH SEPARATOR character (U+2029).

  • The characters CHARACTER TABULATION (U+0009), LINE FEED (U+000A), LINE TABULATION (U+000B), FORM FEED (U+000C), CARRIAGE RETURN (U+000D), and NEXT LINE (U+0085).

The following example demonstrates the IsWhiteSpace(Char) method.

using System;

public class IsWhiteSpaceSample {
	public static void Main() {
		string str = "black matter"; 

		Console.WriteLine(Char.IsWhiteSpace('A'));		// Output: "False"
		Console.WriteLine(Char.IsWhiteSpace(str, 5));	// Output: "True"
	}
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft