- 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 Struct in C#
The Char Struct in C# represents a character as a UTF-16 code unit. Here are some of the methods −
Method | Description |
---|---|
ConvertToUtf32(Char, Char) | Converts the value of a UTF-16 encoded surrogate pair into a Unicode code point. |
ConvertToUtf32(String, Int32) | Converts the value of a UTF-16 encoded character or surrogate pair at a specified position in a string into a Unicode code point. |
Equals(Char) | Returns a value that indicates whether this instance is equal to the specified Char object. |
Equals(Object) | Returns a value that indicates whether this instance is equal to a specified object. |
GetHashCode() | Returns the hash code for this instance. |
GetNumericValue(Char) | Converts the specified numeric Unicode character to a double-precision floating-point number. |
IsDigit(String, Int32) | Indicates whether the character at the specified position in a specified string is categorized as a decimal digit. |
IsLetter(Char) | Indicates whether the specified Unicode character is categorized as a Unicode letter. |
IsLetter(String, Int32) | Indicates whether the character at the specified position in a specified string is categorized as a Unicode letter. |
sLetterOrDigit(Char) | Indicates whether the specified Unicode character is categorized as a letter or a decimal digit. |
IsLetterOrDigit(String, Int32) | Indicates whether the character at the specified position in a specified string is categorized as a letter or a decimal digit. |
IsLower(Char) | Indicates whether the specified Unicode character is categorized as a lowercase letter. |
IsPunctuation(String, Int32) | Indicates whether the character at the specified position in a specified string is categorized as a punctuation mark. |
Let us see an example to implement the Char.IsSymbol() method. The Char.IsSymbol() method in C# is indicated whether the character at the specified position in a specified string is categorized as a symbol character.
Syntax
Following is the syntax −
public static bool IsSymbol (string str, int index);
Above, str is a string, whereas the position of the character to evaluate in str.
Example
Let us now see an example to implement the Char.IsSymbol() method −
using System; public class Demo { public static void Main(){ bool res; char val = 'P'; Console.WriteLine("Value = "+val); res = Char.IsSymbol(val); Console.WriteLine("Is the value a symbol? = "+res); } }
Output
This will produce the following output −
Value = P Is the value a symbol? = False
The Char.IsWhiteSpace() method in C# is used to indicate whether the specified Unicode character is white space.
Syntax
Following is the syntax −
public static bool IsWhiteSpace (char ch);
Above, the parameter ch is the Unicode character to evaluate.
Example
Let us now see an example to implement the Char.IsWhiteSpace() method −
using System; public class Demo { public static void Main(){ bool res; char val = ' '; Console.WriteLine("Value = "+val); res = Char.IsWhiteSpace(val); Console.WriteLine("Is the value whitespace? = "+res); } }
Output
This will produce the following output−
Value = Is the value whitespace? = True