PART II
C h a p t e r 2 1 :
E x p l o r i n g t h e S y s t e m N a m e s p a c e
637
public static bool IsLowSurrogate(char
ch
)
Returns true if
ch
is a valid UTF-32 low surrogate.
Other wise, returns false.
public static bool IsLowSurrogate(string
str
,
int
idx
)
Returns true if
str
[
idx
] is a valid UTF-32 low
surrogate. Other wise, returns false.
public static bool IsNumber(char
ch
)
Returns true if
ch
is a number. Other wise, returns
false.
public static bool IsNumber(string
str
, int
idx
)
Returns true if
str
[
idx
] is a number. Other wise,
returns false.
public static bool IsPunctuation(char
ch
)
Returns true if
ch
is a punctuation character.
Other wise, returns false.
public static bool
IsPunctuation(string
str
, int
idx
)
Returns true if
str
[
idx
] is a punctuation character.
Other wise, returns false.
public static bool IsSeparator(char
ch
)
Returns true if
ch
is a separator character, such
as a space. Other wise, returns false.
public static bool IsSeparator(string
str
, int
idx
)
Returns true if
str
[
idx
] is a separator character,
such as a space. Other wise, returns false.
public static bool IsSurrogate(char
ch
)
Returns true if
ch
is a Unicode surrogate
character. Other wise, returns false.
public static bool IsSurrogate(string
str
, int
idx
)
Returns true if
str
[
idx
] is a Unicode surrogate
character. Other wise, returns false.
public static bool IsSurrogatePair(char
high
,
char
low
)
Returns true if
high
and
low
form a valid
surrogate pair. Other wise, returns false.
public static bool IsSurrogatePair(string
str
,
int
idx
)
Returns true if the two consecutive characters
star ting at
idx
within
str
form a valid surrogate
pair. Other wise, returns false.
public static bool IsSymbol(char
ch
)
Returns true if
ch
is a symbolic character, such
as the currency symbol. Other wise, returns false.
public static bool IsSymbol(string
str
, int
idx
)
Returns true if
str
[
idx
] is a symbolic character,
such as the currency symbol. Other wise, returns
false.
public static bool IsUpper(char
ch
)
Returns true if
ch
is an uppercase letter.
Other wise, returns false.
public static bool IsUpper(string
str
, int
idx
)
Returns true if
str
[
idx
] is an uppercase letter.
Other wise, returns false.
public static bool IsWhiteSpace(char
ch
)
Returns true if
ch
is a whitespace character, such
as a space or tab. Other wise, returns false.
public static bool
IsWhiteSpace(string
str
, int
idx
)
Returns true if
str
[
idx
] is a whitespace character,
such as a space or tab. Other wise, returns false.
T
ABLE
21-9
Methods Defi ned by
Char
(continued)
Method
Meaning
www.freepdf-books.com
638
P a r t I I :
E x p l o r i n g t h e C # L i b r a r y
public static char Parse(string
str
)
Returns the
char
equivalent of the character in
str.
If
str
contains more than one character, a
FormatException
is thrown.
public static char ToLower(char
ch
)
Returns the lowercase equivalent of
ch
if
ch
is
an uppercase letter. Other wise,
ch
is returned
unchanged.
public static char
ToLower(char
ch
, CultureInfo
c
)
Returns the lowercase equivalent of
ch
if
ch
is
an uppercase letter. Other wise,
ch
is returned
unchanged. The conversion is handled in
accordance with the specified cultural
information.
CultureInfo
is a class defined
in
System.Globalization
.
public static char ToLowerInvariant(char
ch
)
Returns the lowercase version of
ch
independently of the cultural settings.
public override string ToString( )
Returns the string representation of the value of
the invoking
Char
.
public static string ToString(char
ch
)
Returns the string representation of
ch.
public string
ToString(IFormatProvider
fmtpvdr
)
Returns the string representation of the invoking
Char
using the specified cultural information.
public static char ToUpper(char
ch
)
Returns the uppercase equivalent of
ch
if
ch
is
a lowercase letter. Other wise,
ch
is returned
unchanged.
public static char ToUpper(char
ch
,
CultureInfo
c
)
Returns the uppercase equivalent of
ch
if
ch
is a lowercase letter. Other wise,
ch
is
returned unchanged. The conversion is handled
in accordance with the specified cultural
information.
CultureInfo
is a class defined
in
System.Globalization
.
public static char ToUpperInvariant(char
ch
)
Returns the uppercase version of
ch
independently of the cultural settings.
public static bool Tr yParse(string
str
,
out char
ch
)
Attempts to convert the character in
str
into its
char
equivalent. If successful, the value is stored
in
ch
and true is returned. If
str
contains more than
one character, false is returned. This differs from
Parse( )
, which throws an exception on failure.
T
ABLE
21-9
Methods Defi ned by
Char
(continued)
Method
Meaning
Here is a program that demonstrates several of the methods defined by
Char
:
// Demonstrate several Char methods.
using System;
class CharDemo {
www.freepdf-books.com
Do'stlaringiz bilan baham: |