char structure and its methods in C#

Learn: roast structure and its techniques in C#.net, it’s a predefined structure, which has a few strategies and properties. Here we will find out about roast structure.

the burn is a pre-characterized structure of .NET system class library. Also, we realize that each structure in the .NET system contains a few techniques and properties to work on it.

There are following significant techniques for burn structure:

  1. char.Parse()
  2. char.Equals()
  3. char.IsDigit()
  4. char.IsLetter()
  5. char.IsSeparator()
  6. char.IsLower()
  7. char.IsUpper()

1) char.Parse()

This strategy is utilized to change over or parse string to roast.

2) char.Equals

This strategy is utilized to check two given character object are equivalent or not. It returns boolean outcome.

3) char.IsDigit()

This strategy is utilized to check given character object is digit or not. It returns Boolean outcome.

4) char.IsLetter()

This technique is utilized to check given character object is letter or not. It returns Boolean outcome.

5) char.IsSeparator()

This strategy is utilized to check given character object is separator or not. It returns Boolean outcome.

6) char.IsLower()

This strategy is utilized to check given character object is in lower case or not. It returns Boolean outcome.

7) char.IsUpper()

This strategy is utilized to check given character object is in capitalized or not. It returns Boolean outcome.

All the above technique can without much of a stretch comprehend with the assistance of the program:

Above program produce the following outcome:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            bool flag = false;
            char val;

            val = char.Parse("A");

            Console.WriteLine("Value is : "+val);

            flag = char.Equals('A','A');

            if(flag == true)
                Console.WriteLine("Both are equal");
            else
                Console.WriteLine("Both are not equal");

            flag = char.IsDigit('A');
            
            if(flag == true)
                Console.WriteLine("Given character is digit");
            else
                Console.WriteLine("Given character is not digit");

            flag = char.IsLetter('A');
            if(flag == true)
                Console.WriteLine("Given character is letter");
            else
                Console.WriteLine("Given character is not letter");

            flag = char.IsLower('a');
            if(flag == true)
                Console.WriteLine("Given character is in lowercase");
            else
                Console.WriteLine("Given character is not in lowercase");

            flag = char.IsUpper('a');
            if(flag == true)
                Console.WriteLine("Given character is in uppercase");
            else
                Console.WriteLine("Given character is not in uppercase");


        }
    }
}

Output:

Value is : A
Both are equal
Given character is not digit
Given character is letter
Given character is in lowercase
Given character is not in uppercase

Leave a Comment

error: Alert: Content is protected!!