
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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
- Related Articles
- UInt16 Struct in C#
- UInt32 Struct in C#
- UInt64 Struct in C#
- Decimal Struct in C#
- Byte Struct in C#
- struct module in Python
- Difference between 'struct' and 'typedef struct' in C++?
- Difference between 'struct' and 'typedef struct' in C++ program?
- C# Int16 Struct
- C# Int32 Struct
- Int 64 Struct in C#
- Path Struct in Rust Programming
- Struct Visibility in Rust Programming
- Difference between char s[] and char *s in C
- Difference between const char* p, char * const p, and const char * const p in C
