IsPunctuation Method (Char)
Collapse the table of content
Expand the table of content

Char.IsPunctuation Method (Char)

.NET Framework 1.1

Indicates whether the specified Unicode character is categorized as a punctuation mark.

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


A Unicode character.

Return Value

true if c is a punctuation mark; otherwise, false.


Valid punctuation marks are members of the following categories in UnicodeCategory: ConnectorPunctuation, DashPunctuation, OpenPunctuation, ClosePunctuation, InititalQuotePunctuation, FinalQuotePunctuation, or OtherPunctuation.


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

[Visual Basic] 
Imports System

Module IsPunctuationSample

    Sub Main()

        Dim ch As Char
        ch = "."c

        Console.WriteLine(Char.IsPunctuation(ch))                   ' Output: "True"
        Console.WriteLine(Char.IsPunctuation("no punctuation", 3))  ' Output: "False"

    End Sub

End Module

using System;

public class IsPunctuationSample {
    public static void Main() {
        char ch = '.';

        Console.WriteLine(Char.IsPunctuation(ch));                        // Output: "True"
        Console.WriteLine(Char.IsPunctuation("no punctuation", 3));        // Output: "False"

#using <mscorlib.dll>
using namespace System;

int main() {
   char ch = '.';

   Console::WriteLine(Char::IsPunctuation(ch));                    // Output: "True"
   Console::WriteLine(Char::IsPunctuation("no punctuation", 3));   // Output: "False"

[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.


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.IsPunctuation Overload List | Boolean

© 2016 Microsoft