Char.IsPunctuation Method (String, Int32)
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Indicates whether the character at the specified position in a specified string is categorized as a punctuation mark.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Shared Function IsPunctuation ( _
s As String, _
index As Integer _
) As Boolean
public static bool IsPunctuation(
string s,
int index
)
Return Value
Type: System.Boolean
true if the character at position index in s is a punctuation mark; otherwise, false.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | s is nulla null reference (Nothing in Visual Basic). |
ArgumentOutOfRangeException | index is less than zero or greater than the last position in s. |
Remarks
Character positions in a string are indexed starting from zero.
Valid punctuation marks are members of the following categories in UnicodeCategory: ConnectorPunctuation, DashPunctuation, OpenPunctuation, ClosePunctuation, InititalQuotePunctuation, FinalQuotePunctuation, or OtherPunctuation. They include characters with the Unicode code points listed in the following table.
U+0021 to U+0023 |
U+060C and U+060D |
U+1800 to U+180A |
U+3014 to U+301F |
U+0025 to U+002A |
U+061B |
U+1944 and U+1945 |
U+3030 |
U+002C to U+002F |
U+061E and U+061F |
U+19DE and U+19DF |
U+303D |
U+003A and U+003B |
U+066A to U+066D |
U+1A1E and U+1A1F |
U+30A0 |
U+003F and U+0040 |
U+06D4 |
U+1B5A to U+1B60 |
U+30FB |
U+005B to U+005D |
U+0700 to U+070D |
U+2010 to U+2027 |
U+A874 to U+A877 |
U+005F |
U+07F7 to U+07F9 |
U+2030 to U+2043 |
U+FD3E and U+FD3F |
U+007B |
U+0964 and U+0965 |
U+2045 to U+2051 |
U+FE10 to U+FE19 |
U+007D |
U+0970 |
U+2053 to U+205E |
U+FE30 to U+FE52 |
U+00A1 |
U+0DF4 |
U+207D and U+207E |
U+FE54 to U+FE61 |
U+00AB |
U+0E4F to U+0E5B |
U+208D and U+208E |
U+FE63 |
U+00AD |
U+0F04 to U+0F12 |
U+2329 and U+232A |
U+FE68 |
U+00B7 |
U+0F3A to U+0F3D |
U+2768 to U+2775 |
U+FE6A and U+FE6B |
U+00BB |
U+0F85 |
U+27C5 to U+27C6 |
U+FF01 to U+FF03 |
U+00BF |
U+0FD0 and U+0FD1 |
U+27E6 to U+27EB |
U+FF05 to U+FF0A |
U+037E |
U+104A to U+104F |
U+2983 to U+2998 |
U+FF0C to U+FF0F |
U+0387 |
U+10FB |
U+29D8 to U+29DB |
U+FF1A and U+FF1B |
U+055A to U+055F |
U+1361 to U+1368 |
U+29FC and U+29FD |
U+FF1F and U+FF20 |
U+0589 and U+058A |
U+166D and U+166E |
U+2CF9 to U+2CFC |
U+FF3B to U+FF3D |
U+05BE |
U+169B and U+169C |
U+2CFE and U+2CFF |
U+FF3F |
U+05C0 |
U+16EB to U+16ED |
U+2E00 to U+2E17 |
U+FF5B |
U+05C3 |
U+1735 and U+1736 |
U+2E1C and U+2E1D |
U+FF5D |
U+05C6 |
U+17D4 to U+17D6 |
U+3001 to U+3003 |
U+FF5F to U+FF65 |
U+05F3 and U+05F4 |
U+17D8 to U+17DA |
U+3008 to U+3011 |
Examples
The following example demonstrates IsPunctuation.
Module Example
Public Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
Dim ch As Char
ch = "."c
outputBlock.Text &= Char.IsPunctuation(ch) & vbCrLf ' Output: "True"
outputBlock.Text += String.Format(Char.IsPunctuation("no punctuation", 3)) & vbCrLf ' Output: "False"
End Sub
End Module
using System;
public class Example
{
public static void Demo(System.Windows.Controls.TextBlock outputBlock)
{
char ch = '.';
outputBlock.Text += Char.IsPunctuation(ch).ToString() + "\n";
outputBlock.Text += Char.IsPunctuation("no punctuation", 3).ToString();
}
}
// This example produces the following output:
// True
// False
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
XNA Framework
Supported in: Xbox 360, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.