C# Char IsPunctuation(String, Int32)
Description
Char IsPunctuation(String, Int32)
indicates whether
the character at the specified position in a specified string is categorized
as a punctuation mark.
Syntax
Char.IsPunctuation(String, Int32)
has the following syntax.
public static bool IsPunctuation(
string s,
int index
)
Parameters
Char.IsPunctuation(String, Int32)
has the following parameters.
s
- A string.index
- The position of the character to evaluate in s.
Returns
Char.IsPunctuation(String, Int32)
method returns true if the character at position index in s is a punctuation mark; otherwise,
false.
Example
The following code example demonstrates IsPunctuation.
//w w w.j a v a 2 s. c o m
using System;
public class MainClass {
public static void Main() {
char ch = '.';
Console.WriteLine(Char.IsPunctuation("no punctuation", 3)); // Output: "False"
}
}
The code above generates the following result.