Char.IsSymbol() Method in C#


The Char.IsSymbol() method in C# is indicating whether the character at the specified position in a specified string is categorized as a symbol character.

Syntax

public static bool IsSymbol (string str, int index);

Above, str is a string, whereas the position of the character to evaluate in str.

Let us now see an example to implement the Char.IsSymbol() method −

Example

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

Let us see another example −

Example

using System;
public class Demo {
   public static void Main(){
      bool res;
      char val = '+';
      Console.WriteLine("Value = "+val);
      res = Char.IsSymbol(val);
      Console.WriteLine("Is the value a symbol? = "+res);
   }
}

Output

This will produce the following output −

Value = +
Is the value a symbol? = True

Updated on: 04-Nov-2019

296 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements