.NET Framework Class Library
Char.IsWhiteSpace Method (Char)

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

[Visual Basic]
Overloads Public Shared Function IsWhiteSpace( _
   ByVal c As Char _
) As Boolean
[C#]
public static bool IsWhiteSpace(
 char c
);
[C++]
public: static bool IsWhiteSpace(
 __wchar_t c
);
[JScript]
public static function IsWhiteSpace(
   c : Char
) : Boolean;

Parameters

c
A Unicode character.

Return Value

true if c is white space; otherwise, false.

Remarks

Valid white space characters are members of the SpaceSeparator category in UnicodeCategory, as well as these Unicode characters: hexadecimal 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x0085, 0x2028, and 0x2029.

Example

[Visual Basic, C#, C++] The following sample demonstrates IsWhiteSpace.

[Visual Basic] 
imports System

Module IsWhiteSpaceSample

    Sub Main()

        Dim str As String
        str = "black matter"

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

    End Sub

End Module

[C#] 
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"
    }
}

[C++] 
#using <mscorlib.dll>
using namespace System;

int main() {
   String* str = "black matter"; 

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

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Char Structure | Char Members | System Namespace | Char.IsWhiteSpace Overload List | Boolean

Page view tracker