Char.IsSeparator Method

Definition

Indicates whether a Unicode character is categorized as a separator character.

Overloads

IsSeparator(Char)

Indicates whether the specified Unicode character is categorized as a separator character.

IsSeparator(String, Int32)

Indicates whether the character at the specified position in a specified string is categorized as a separator character.

Remarks

The Unicode standard recognizes three subcategories of separators:

참고

The Unicode standard classifies the characters \u000A (LF), \u000C (FF), and \u000D (CR) as control characters (members of the UnicodeCategory.Control category), not as separator characters.

IsSeparator(Char)

Source:
Char.cs
Source:
Char.cs
Source:
Char.cs

Indicates whether the specified Unicode character is categorized as a separator character.

C#
public static bool IsSeparator (char c);

Parameters

c
Char

The Unicode character to evaluate.

Returns

true if c is a separator character; otherwise, false.

Examples

The following example lists the Char objects that are classified as separator characters.

C#
using System;

public class Class1
{
   public static void Main()
   {
      for (int ctr = (int)(Char.MinValue); ctr <= (int)(Char.MaxValue); ctr++)
      {
         char ch = (Char)ctr;
         if (Char.IsSeparator(ch))
            Console.WriteLine(@"\u{(int)ch:X4} ({Char.GetUnicodeCategory(ch)})");
      }
   }
}
// The example displays the following output:
//       \u0020 (SpaceSeparator)
//       \u00A0 (SpaceSeparator)
//       \u1680 (SpaceSeparator)
//       \u180E (SpaceSeparator)
//       \u2000 (SpaceSeparator)
//       \u2001 (SpaceSeparator)
//       \u2002 (SpaceSeparator)
//       \u2003 (SpaceSeparator)
//       \u2004 (SpaceSeparator)
//       \u2005 (SpaceSeparator)
//       \u2006 (SpaceSeparator)
//       \u2007 (SpaceSeparator)
//       \u2008 (SpaceSeparator)
//       \u2009 (SpaceSeparator)
//       \u200A (SpaceSeparator)
//       \u2028 (LineSeparator)
//       \u2029 (ParagraphSeparator)
//       \u202F (SpaceSeparator)
//       \u205F (SpaceSeparator)
//       \u3000 (SpaceSeparator)

Remarks

The Unicode standard recognizes three subcategories of separators:

참고

The Unicode standard classifies the characters \u000A (LF), \u000C (FF), and \u000D (CR) as control characters (members of the UnicodeCategory.Control category), not as separator characters.

See also

Applies to

.NET 9 및 기타 버전
제품 버전
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0

IsSeparator(String, Int32)

Source:
Char.cs
Source:
Char.cs
Source:
Char.cs

Indicates whether the character at the specified position in a specified string is categorized as a separator character.

C#
public static bool IsSeparator (string s, int index);

Parameters

s
String

A string.

index
Int32

The position of the character to evaluate in s.

Returns

true if the character at position index in s is a separator character; otherwise, false.

Exceptions

index is less than zero or greater than the last position in s.

Examples

The following example demonstrates IsSeparator.

C#
using System;

public class IsSeparatorSample {
    public static void Main() {
        string str = "twain1 twain2";

        Console.WriteLine(Char.IsSeparator('a'));		// Output: "False"
        Console.WriteLine(Char.IsSeparator(str, 6));	// Output: "True"
    }
}

Remarks

Character positions in a string are indexed starting from zero.

The Unicode standard recognizes three subcategories of separators:

참고

The Unicode standard classifies the characters \u000A (LF), \u000C (FF), and \u000D (CR) as control characters (members of the UnicodeCategory.Control category), not as separator characters.

See also

Applies to

.NET 9 및 기타 버전
제품 버전
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0