Char.IsWhiteSpace Char.IsWhiteSpace Char.IsWhiteSpace Char.IsWhiteSpace Method

定義

指示 Unicode 字元是否分類為泛空白字元 (White Space)。Indicates whether a Unicode character is categorized as white space.

多載

IsWhiteSpace(Char) IsWhiteSpace(Char) IsWhiteSpace(Char) IsWhiteSpace(Char)

指示指定的 Unicode 字元是否分類為泛空白字元。Indicates whether the specified Unicode character is categorized as white space.

IsWhiteSpace(String, Int32) IsWhiteSpace(String, Int32) IsWhiteSpace(String, Int32) IsWhiteSpace(String, Int32)

指示指定的字串中指定位置處的字元是否分類為泛空白字元。Indicates whether the character at the specified position in a specified string is categorized as white space.

備註

空白字元是下列 Unicode 字元:White space characters are the following Unicode characters:

  • UnicodeCategory.SpaceSeparator類別目錄的成員,其中包括字元空間(U + 0020)、無中斷空間(U + 00A0)、歐線空間標記(u + 1680)、EN 四(u + 2000)、em 四(u + 2001)、EN 空格(u + 2002)、em 空格(u + 2003)、每個每 em 空間(u + 2004)、四個空格(U + 2005)、六個空格(U + 2006)、圖空間(U + 2007)、標點符號空間(U + 2008)、細空格(U + 2009)、小數位數(U + 200A)、窄式無間距空間(u + 202F)、中度數學空間(u + 205F)和表意文字空間(U + 3000)。Members of the UnicodeCategory.SpaceSeparator category, which includes the characters SPACE (U+0020), NO-BREAK SPACE (U+00A0), OGHAM SPACE MARK (U+1680), EN QUAD (U+2000), EM QUAD (U+2001), EN SPACE (U+2002), EM SPACE (U+2003), THREE-PER-EM SPACE (U+2004), FOUR-PER-EM SPACE (U+2005), SIX-PER-EM SPACE (U+2006), FIGURE SPACE (U+2007), PUNCTUATION SPACE (U+2008), THIN SPACE (U+2009), HAIR SPACE (U+200A), NARROW NO-BREAK SPACE (U+202F), MEDIUM MATHEMATICAL SPACE (U+205F), and IDEOGRAPHIC SPACE (U+3000).

  • UnicodeCategory.LineSeparator類別目錄的成員,其僅包含行分隔符號(U + 2028)。Members of the UnicodeCategory.LineSeparator category, which consists solely of the LINE SEPARATOR character (U+2028).

  • UnicodeCategory.ParagraphSeparator類別目錄的成員,僅由段落分隔符號(U + 2029)組成。Members of the UnicodeCategory.ParagraphSeparator category, which consists solely of the PARAGRAPH SEPARATOR character (U+2029).

  • 字元字元表(U + 0009)、換行(U + 000A)、行號(U + 000B)、表單摘要(U + 000C)、回車(U + 000D)和下一行(U + 0085)。The characters CHARACTER TABULATION (U+0009), LINE FEED (U+000A), LINE TABULATION (U+000B), FORM FEED (U+000C), CARRIAGE RETURN (U+000D), and NEXT LINE (U+0085).

IsWhiteSpace(Char) IsWhiteSpace(Char) IsWhiteSpace(Char) IsWhiteSpace(Char)

指示指定的 Unicode 字元是否分類為泛空白字元。Indicates whether the specified Unicode character is categorized as white space.

public:
 static bool IsWhiteSpace(char c);
public static bool IsWhiteSpace (char c);
static member IsWhiteSpace : char -> bool
Public Shared Function IsWhiteSpace (c As Char) As Boolean

參數

c
Char Char Char Char

要評估的 Unicode 字元。The Unicode character to evaluate.

傳回

true 是空白字元時為 c,否則為 falsetrue if c is white space; otherwise, false.

範例

下列範例示範IsWhiteSpace(Char)方法。The following example demonstrates the IsWhiteSpace(Char) method.

using namespace System;
int main()
{
   String^ str =  "black matter";
   Console::WriteLine( Char::IsWhiteSpace( 'A' ) ); // Output: "False"
   Console::WriteLine( Char::IsWhiteSpace( str, 5 ) ); // Output: "True"
}

using System;

public class IsWhiteSpaceSample {
    public static void Main() {
        string str = "black matter"; 

        Console.WriteLine(Char.IsWhiteSpace('A'));		// Output: "False"
        Console.WriteLine(Char.IsWhiteSpace(str, 5));	// Output: "True"
    }
}
Module IsWhiteSpaceSample

    Sub Main()

        Dim str As String
        str = "black matter"

        Console.WriteLine(Char.IsWhiteSpace("A"c))      ' Output: "False"
        Console.WriteLine(Char.IsWhiteSpace(str, 5))    ' Output: "True"

    End Sub

End Module

備註

空白字元是下列 Unicode 字元:White space characters are the following Unicode characters:

  • UnicodeCategory.SpaceSeparator類別目錄的成員,其中包括字元空間(U + 0020)、無中斷空間(U + 00A0)、歐線空間標記(u + 1680)、EN 四(u + 2000)、em 四(u + 2001)、EN 空格(u + 2002)、em 空格(u + 2003)、每個每 em 空間(u + 2004)、四個空格(U + 2005)、六個空格(U + 2006)、圖空間(U + 2007)、標點符號空間(U + 2008)、細空格(U + 2009)、小數位數(U + 200A)、窄式無間距空間(u + 202F)、中度數學空間(u + 205F)和表意文字空間(U + 3000)。Members of the UnicodeCategory.SpaceSeparator category, which includes the characters SPACE (U+0020), NO-BREAK SPACE (U+00A0), OGHAM SPACE MARK (U+1680), EN QUAD (U+2000), EM QUAD (U+2001), EN SPACE (U+2002), EM SPACE (U+2003), THREE-PER-EM SPACE (U+2004), FOUR-PER-EM SPACE (U+2005), SIX-PER-EM SPACE (U+2006), FIGURE SPACE (U+2007), PUNCTUATION SPACE (U+2008), THIN SPACE (U+2009), HAIR SPACE (U+200A), NARROW NO-BREAK SPACE (U+202F), MEDIUM MATHEMATICAL SPACE (U+205F), and IDEOGRAPHIC SPACE (U+3000).

  • UnicodeCategory.LineSeparator類別目錄的成員,其僅包含行分隔符號(U + 2028)。Members of the UnicodeCategory.LineSeparator category, which consists solely of the LINE SEPARATOR character (U+2028).

  • UnicodeCategory.ParagraphSeparator類別目錄的成員,僅由段落分隔符號(U + 2029)組成。Members of the UnicodeCategory.ParagraphSeparator category, which consists solely of the PARAGRAPH SEPARATOR character (U+2029).

  • 字元字元表(U + 0009)、換行(U + 000A)、行號(U + 000B)、表單摘要(U + 000C)、回車(U + 000D)和下一行(U + 0085)。The characters CHARACTER TABULATION (U+0009), LINE FEED (U+000A), LINE TABULATION (U+000B), FORM FEED (U+000C), CARRIAGE RETURN (U+000D), and NEXT LINE (U+0085).

另請參閱

IsWhiteSpace(String, Int32) IsWhiteSpace(String, Int32) IsWhiteSpace(String, Int32) IsWhiteSpace(String, Int32)

指示指定的字串中指定位置處的字元是否分類為泛空白字元。Indicates whether the character at the specified position in a specified string is categorized as white space.

public:
 static bool IsWhiteSpace(System::String ^ s, int index);
public static bool IsWhiteSpace (string s, int index);
static member IsWhiteSpace : string * int -> bool
Public Shared Function IsWhiteSpace (s As String, index As Integer) As Boolean

參數

s
String String String String

字串。A string.

index
Int32 Int32 Int32 Int32

要評估的字元在 s 中的位置。The position of the character to evaluate in s.

傳回

true 中位於 index 的字元是空白字元時為 s,否則為 falsetrue if the character at position index in s is white space; otherwise, false.

例外狀況

index 小於零或大於 s 中的最後一個位置。index is less than zero or greater than the last position in s.

範例

下列程式碼範例將IsWhiteSpace示範。The following code example demonstrates IsWhiteSpace.

using namespace System;
int main()
{
   String^ str =  "black matter";
   Console::WriteLine( Char::IsWhiteSpace( 'A' ) ); // Output: "False"
   Console::WriteLine( Char::IsWhiteSpace( str, 5 ) ); // Output: "True"
}

using System;

public class IsWhiteSpaceSample {
    public static void Main() {
        string str = "black matter"; 

        Console.WriteLine(Char.IsWhiteSpace('A'));		// Output: "False"
        Console.WriteLine(Char.IsWhiteSpace(str, 5));	// Output: "True"
    }
}
Module IsWhiteSpaceSample

    Sub Main()

        Dim str As String
        str = "black matter"

        Console.WriteLine(Char.IsWhiteSpace("A"c))      ' Output: "False"
        Console.WriteLine(Char.IsWhiteSpace(str, 5))    ' Output: "True"

    End Sub

End Module

備註

字串中的字元位置會從零開始編制索引。Character positions in a string are indexed starting from zero.

空白字元是下列 Unicode 字元:White space characters are the following Unicode characters:

  • UnicodeCategory.SpaceSeparator類別目錄的成員,其中包括字元空間(U + 0020)、無中斷空間(U + 00A0)、歐線空間標記(u + 1680)、EN 四(u + 2000)、em 四(u + 2001)、EN 空格(u + 2002)、em 空格(u + 2003)、每個每 em 空間(u + 2004)、四個空格(U + 2005)、六個空格(U + 2006)、圖空間(U + 2007)、標點符號空間(U + 2008)、細空格(U + 2009)、小數位數(U + 200A)、窄式無間距空間(u + 202F)、中度數學空間(u + 205F)和表意文字空間(U + 3000)。Members of the UnicodeCategory.SpaceSeparator category, which includes the characters SPACE (U+0020), NO-BREAK SPACE (U+00A0), OGHAM SPACE MARK (U+1680), EN QUAD (U+2000), EM QUAD (U+2001), EN SPACE (U+2002), EM SPACE (U+2003), THREE-PER-EM SPACE (U+2004), FOUR-PER-EM SPACE (U+2005), SIX-PER-EM SPACE (U+2006), FIGURE SPACE (U+2007), PUNCTUATION SPACE (U+2008), THIN SPACE (U+2009), HAIR SPACE (U+200A), NARROW NO-BREAK SPACE (U+202F), MEDIUM MATHEMATICAL SPACE (U+205F), and IDEOGRAPHIC SPACE (U+3000).

  • UnicodeCategory.LineSeparator類別目錄的成員,其僅包含行分隔符號(U + 2028)。Members of the UnicodeCategory.LineSeparator category, which consists solely of the LINE SEPARATOR character (U+2028).

  • UnicodeCategory.ParagraphSeparator類別目錄的成員,僅由段落分隔符號(U + 2029)組成。Members of the UnicodeCategory.ParagraphSeparator category, which consists solely of the PARAGRAPH SEPARATOR character (U+2029).

  • 字元字元表(U + 0009)、換行(U + 000A)、行號(U + 000B)、表單摘要(U + 000C)、回車(U + 000D)和下一行(U + 0085)。The characters CHARACTER TABULATION (U+0009), LINE FEED (U+000A), LINE TABULATION (U+000B), FORM FEED (U+000C), CARRIAGE RETURN (U+000D), and NEXT LINE (U+0085).

另請參閱

適用於