This documentation is archived and is not being maintained.

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
)
public static boolean IsWhiteSpace (
	char c
)
public static function IsWhiteSpace (
	c : char
) : boolean

Parameters

c

A Unicode character.

Return Value

true if c is white space; otherwise, false.

White space characters are the following Unicode characters:

  • Members of the SpaceSeparator category, which includes the SPACE character (U+0020).

  • 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), NEXT LINE (U+0085), and NO-BREAK SPACE (U+0000A0).

The following code example demonstrates IsWhiteSpace.

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"
	}
}

import System.* ;

public class IsWhiteSpaceSample
{
    public static void main(String[] args)
    {
        String str = "black matter";
      
        Console.WriteLine(Char.IsWhiteSpace('A'));        // Output: "False"
        Console.WriteLine(Char.IsWhiteSpace(str, 5));    // Output: "True"
    }//main
} //IsWhiteSpaceSample

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Show: