![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Char.IsControl(String, Int32) Method in C#
The Char.IsControl(String, Int32) method in C# is used to indicate whether the character at the specified position in a specified string is categorized as a control character.
Syntax
public static bool IsControl (string str, int index);
Above, str is a string. The index parameter is the position of the character to evaluate in str.
Let us now see an example to implement the Char.IsControl(String, Int32) method −
Example
using System; using System.Globalization; public class Demo { public static void Main(){ string val = "hjk9878hj"; Console.WriteLine("String = "+val); UnicodeCategory unicode = Char.GetUnicodeCategory(val, 4); Console.WriteLine("The value at specific index = "+unicode); bool res = Char.IsControl(val, 4); if (res) Console.WriteLine("Control character found!"); else Console.WriteLine("Control character isn't there"); } }
Output
This will produce the following output −
String = hjk9878hj The value at specific index = DecimalDigitNumber Control character isn't there
Advertisements