In C#, Char.IsSeparator returns true for Unicode separator characters (space, line, and paragraph separators).
A plain space is a separator. Tab and newline are whitespace/control but are not separators in this API.
This is a static member of System.Char. You call it with the type name, such as Char.IsSeparator(...) or char.IsSeparator(...). A char holds one 16-bit UTF-16 code unit.
Syntax
Pass the character to test.
C#
bool ok = Char.IsSeparator(' ');
Call
What it does
Char.IsSeparator(c)
True if c is a separator.
Char.IsSeparator(s, i)
Tests s[i].
Prefer IsWhiteSpace when you want tabs and newlines included.
Library declarations
C#
public static bool IsSeparator(char c);
public static bool IsSeparator(string s, int index);
Parameters
Parameter
Description
c
Character to test.
s, index
Optional string index overload.
Return Value
Return Value
Description
true
Separator character.
false
Not a separator.
C# Examples
Example 1 — Space Is Separator
Test space versus a letter.
C#
using System;
class Program {
static void Main() {
Console.WriteLine(Char.IsSeparator(' '));
Console.WriteLine(Char.IsSeparator('x'));
}
}
Output
True
False
How It Works
Space separator. Ordinary space matches.
Letter x. Not a separator.
True/False. Simple classification printout.
Category Zs. Space sits in separator classes.
Example 2 — Tab Is Not Separator
Compare IsSeparator with IsWhiteSpace on tab.
C#
using System;
class Program {
static void Main() {
char tab = '\t';
Console.WriteLine("separator: " + Char.IsSeparator(tab));
Console.WriteLine("whitespace: " + Char.IsWhiteSpace(tab));
}
}
Output
separator: False
whitespace: True
How It Works
Tab contrast. Separators exclude tab.
Still whitespace. IsWhiteSpace is true.
API nuance. Names sound similar but categories differ.
Pick IsWhiteSpace. When trimming general blanks, prefer it.
Example 3 — Count Spaces
Count separator characters in a phrase.
C#
using System;
class Program {
static void Main() {
string s = "a b c";
int n = 0;
foreach (char ch in s) {
if (Char.IsSeparator(ch)) n++;
}
Console.WriteLine(n);
}
}
Output
3
How It Works
Three spaces. Including a double gap.
Loop tally. Increment per separator.
Letters ignored. a, b, c do not count.
Space focus. Tabs would not add here.
Frequently Asked Questions
Yes.
No. Tab is whitespace/control, not a separator category.
Usually no for ; use IsWhiteSpace for line breaks.
Use IsWhiteSpace for general blank detection; IsSeparator for Unicode separator categories only.