C# | Char.IsWhiteSpace() Method Last Updated : 31 Jan, 2019 Comments Improve Suggest changes Like Article Like Report In C#, Char.IsWhiteSpace() is a System.Char struct method which is used to check whether a Unicode character is a whitespace or not. Whitespace characters include Unicode characters of category SpaceSeparator, LineSeparator, ParagraphSeparator etc. This method can be overloaded by passing different type and number of arguments to it. Char.IsWhiteSpace(Char) Method Char.IsWhiteSpace (String, Int32) Method Char.IsWhiteSpace(Char) Method This method is used to check whether a specified Unicode character can be categorized as a whitespace character or not. If it can be categorized as whitespace then it returns True otherwise return False. Syntax: public static bool IsWhiteSpace(char ch); Parameter: ch: It is required Unicode character of System.char type which is to be checked for whitespace. Return Type : The method returns True if the specified Unicode character is a whitespace character, otherwise returns False. The return type of this method is System.Boolean. Example: CSHARP // C# program to illustrate the // Char.IsWhiteSpace(Char) Method using System; class GFG { // Main Method static public void Main() { // Declaration of data type bool result; // checking if space // is a whitespace char ch1 = ' '; result = Char.IsWhiteSpace(ch1); Console.WriteLine(result); // checking if carriage return // is a whitespace char ch2 = '\n'; result = Char.IsWhiteSpace(ch2); Console.WriteLine(result); // checking if hyphen // is a whitespace char ch3 = '-'; result = Char.IsWhiteSpace(ch3); Console.WriteLine(result); } } Output: True True False Char.IsWhiteSpace(String, Int32) Method This method is used to check whether a character in the specified string at the specified position can be categorized as whitespace or not. It returns True when the character is a whitespace character otherwise it returns False. Syntax: public static bool Char.IsWhiteSpace(string str, int index); Parameters: Str: It is the required string of System.String type whose character is to be checked. index: It is the position of character in the specified string and type of this parameter is System.Int32. Return Type: The method returns True if the character at specified index in the specified string can be categorized as whitespace, otherwise returns False. The return type of this method is System.Boolean. Example: CSHARP // C# program to illustrate the // Char.IsWhiteSpace (String, Int32) Method using System; class GFG { // Main Method static public void Main() { // Declaration of data type bool result; // checking for whitespace // in a string string str1 = "GeeksforGeeks"; result = Char.IsWhiteSpace(str1, 2); Console.WriteLine(result); // checking for whitespace // in a string string str2 = "Geeks For Geeks"; result = Char.IsWhiteSpace(str2, 5); Console.WriteLine(result); } } Output: False True Reference: https://docs.microsoft.com/en-us/dotnet/api/system.char.iswhitespace?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article C# | Char.IsWhiteSpace() Method I ihritik Follow Improve Article Tags : C# CSharp-method CSharp-Char-Struct Similar Reads C# | Char.IsControl(String, Int32) Method This method is used to indicates whether the character at the specified position in a specified string is categorized as a control character. Syntax: public static bool IsControl (string s, int index); Parameters: s: It is the String. index: It is the character position in s. Return Value: This meth 3 min read C# | Char.IsDigit() Method In C#, Char.IsDigit() is a System.Char struct method which is used to check whether a Unicode character can be categorized as a decimal digit(radix 10) or not. Valid digits will be the members of the UnicodeCategory.DecimalDigitNumber category. This method can be overloaded by passing different type 3 min read C# | Char.IsHighSurrogate(String, Int32) Method This method is used to indicates whether the Char object at the specified position in a string is a high surrogate or not. Syntax: public static bool IsHighSurrogate (string s, int index); Parameters: s: It is a String. index: It is the character position in s. Return Value: This method returns true 4 min read C# | Char.IsLetter() Method In C#, Char.IsLetter() is a System.Char struct method which is used to check whether a Unicode character can be categorized as a Unicode letter or not. Unicode letters consist of the Uppercase letters, Lowercase letters, Title case letters, Modifiers letters and Other letters. This method can be ove 3 min read C# | Char.IsLetterOrDigit() Method In C#, Char.IsLetterOrDigit() is a System.Char struct method which is used to check whether a Unicode character can be categorized as a letter or decimal digit. Valid letters and decimal digits will be the members of the UnicodeCategory: UppercaseLetter, LowercaseLetter, TitlecaseLetter, ModifierLet 3 min read C# | Char.IsLower() Method In C#, Char.IsLower() is a System.Char struct method which is used to check whether a Unicode character can be categorized as a lowercase letter or not. Valid lowercase letters will be the members of UnicodeCategory: LowercaseLetter. This method can be overloaded by passing different type and number 3 min read C# | Char.IsLowSurrogate(String, Int32) Method This method is used to indicates whether the Char object at the specified position in a string is a low surrogate or not. Syntax: public static bool IsLowSurrogate (string s, int index); Parameters: s: It is a String. index: It is the character position to evaluate in s. Return Value: This method re 4 min read C# | Char.IsNumber() Method In C#, Char.IsNumber() is a System.Char struct method which is used to check whether a Unicode character can be categorized as a number or not. Valid numbers will be the members of the UnicodeCategory.DecimalDigitNumber, UnicodeCategory.LetterNumber, or UnicodeCategory.OtherNumber category. This met 3 min read C# | Char.IsPunctuation() Method In C#, Char.IsPunctuation() is a System.Char struct method which is used to check whether an Unicode character can be categorized as a punctuation mark or not. This method can be overloaded by passing different type and number of arguments to it. Char.IsPunctuation(Char) Method Char.IsPunctuation(St 3 min read C# | Char.IsSeparator ( ) Method In C#, Char.IsSeparator() is a System.Char struct method which is used to check whether a Unicode character can be categorized as a separator character or not. This method can be overloaded by passing different type and number of arguments to it. Char.IsSeparator(Char) MethodChar.IsSeparator(String, 3 min read Like