Export (0) Print
Expand All

Char.IsPunctuation Method

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

Overload List

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

Supported by the .NET Compact Framework.

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

Indicates whether the character at the specified position in a specified string is categorized as a punctuation mark.

[Visual Basic] Overloads Public Shared Function IsPunctuation(String, Integer) As Boolean
[C#] public static bool IsPunctuation(string, int);
[C++] public: static bool IsPunctuation(String*, int);
[JScript] public static function IsPunctuation(String, int) : Boolean;

Example

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

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of IsPunctuation. For other examples that might be available, see the individual overload topics.
[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

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

[C++] 
#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.

See Also

Char Structure | Char Members | System Namespace

Show:
© 2014 Microsoft