pub struct JavaCharacter<'mc>(/* private fields */);Expand description
The Character class wraps a value of the primitive
type char in an object. An object of class
Character contains a single field whose type is
char.
In addition, this class provides a large number of static methods for determining a character's category (lowercase letter, digit, etc.) and for converting characters from uppercase to lowercase and vice versa.
Unicode Conformance
The fields and methods of class Character are defined in terms
of character information from the Unicode Standard, specifically the
UnicodeData file that is part of the Unicode Character Database.
This file specifies properties including name and category for every
assigned Unicode code point or character range. The file is available
from the Unicode Consortium at
http://www.unicode.org.
The Java SE 8 Platform uses character information from version 6.2
of the Unicode Standard, with three extensions. First, in recognition of the fact
that new currencies appear frequently, the Java SE 8 Platform allows an
implementation of class Character to use the Currency Symbols
block from version 10.0 of the Unicode Standard. Second, the Java SE 8 Platform
allows an implementation of class Character to use the code points
in the range of U+9FCD to U+9FEF from version 11.0 of the
Unicode Standard and in the CJK Unified Ideographs Extension E block
from version 8.0 of the Unicode Standard, in order for the class to allow the
"Implementation Level 2" of the Chinese GB18030-2022 standard.
Third, the Java SE 8 Platform
allows an implementation of class Character to use the Japanese Era
code point, U+32FF, from the Unicode Standard version 12.1.
Consequently, the
behavior of fields and methods of class Character may vary across
implementations of the Java SE 8 Platform when processing the aforementioned
code points ( outside of version 6.2 ), except for the following methods
that define Java identifiers:
isJavaIdentifierStart(int), isJavaIdentifierStart(char),
isJavaIdentifierPart(int), and isJavaIdentifierPart(char).
Code points in Java identifiers must be drawn from version 6.2 of
the Unicode Standard.
Unicode Character Representations
The char data type (and therefore the value that a
Character object encapsulates) are based on the
original Unicode specification, which defined characters as
fixed-width 16-bit entities. The Unicode Standard has since been
changed to allow for characters whose representation requires more
than 16 bits.The range of legal code points is now
U+0000 to U+10FFFF, known as Unicode scalar value.
(Refer to the
definition of the U+n notation in the Unicode
Standard.)
The set of characters from U+0000 to U+FFFF is
sometimes referred to as the Basic Multilingual Plane (BMP).
Characters whose code points are greater
than U+FFFF are called supplementary characters.The Java
platform uses the UTF-16 representation in char arrays and
in the String and StringBuffer classes. In
this representation, supplementary characters are represented as a pair
of char values, the first from the high-surrogates
range, (\uD800-\uDBFF), the second from the
low-surrogates range (\uDC00-\uDFFF).
A char value, therefore, represents Basic
Multilingual Plane (BMP) code points, including the surrogate
code points, or code units of the UTF-16 encoding. An
int value represents all Unicode code points,
including supplementary code points. The lower (least significant)
21 bits of int are used to represent Unicode code
points and the upper (most significant) 11 bits must be zero.
Unless otherwise specified, the behavior with respect to
supplementary characters and surrogate char values is
as follows:
- The methods that only accept a
charvalue cannot support supplementary characters. They treatcharvalues from the surrogate ranges as undefined characters. For example,Character.isLetter('\uD840')returnsfalse, even though this specific value if followed by any low-surrogate value in a string would represent a letter. - The methods that accept an
intvalue support all Unicode characters, including supplementary characters. For example,Character.isLetter(0x2F81A)returnstruebecause the code point value represents a letter (a CJK ideograph).
In the Java SE API documentation, Unicode code point is
used for character values in the range between U+0000 and U+10FFFF,
and Unicode code unit is used for 16-bit
char values that are code units of the UTF-16
encoding. For more information on Unicode terminology, refer to the
Unicode Glossary.
Implementations§
Source§impl<'mc> JavaCharacter<'mc>
impl<'mc> JavaCharacter<'mc>
pub fn new( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<JavaCharacter<'mc>, Box<dyn Error>>
pub fn get_name( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<String, Box<dyn Error>>
pub fn is_java_identifier_start_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn is_java_identifier_part_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn equals(&self, arg0: JObject<'mc>) -> Result<bool, Box<dyn Error>>
pub fn to_string_with_char( jni: &SharedJNIEnv<'mc>, arg0: Option<u16>, ) -> Result<String, Box<dyn Error>>
pub fn hash_code_with_char( jni: &SharedJNIEnv<'mc>, arg0: Option<u16>, ) -> Result<i32, Box<dyn Error>>
pub fn reverse_bytes( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<u16, Box<dyn Error>>
pub fn compare_to_with_character( &self, arg0: u16, ) -> Result<i32, Box<dyn Error>>
pub fn is_digit_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_lower_case_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_upper_case_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn is_whitespace_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn compare( jni: &SharedJNIEnv<'mc>, arg0: u16, arg1: u16, ) -> Result<i32, Box<dyn Error>>
pub fn char_value(&self) -> Result<u16, Box<dyn Error>>
pub fn to_chars_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, arg1: Option<Vec<u16>>, arg2: Option<i32>, ) -> Result<i32, Box<dyn Error>>
pub fn is_high_surrogate( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_low_surrogate( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_surrogate( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_supplementary_code_point( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn high_surrogate( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<u16, Box<dyn Error>>
pub fn low_surrogate( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<u16, Box<dyn Error>>
pub fn to_code_point( jni: &SharedJNIEnv<'mc>, arg0: u16, arg1: u16, ) -> Result<i32, Box<dyn Error>>
pub fn code_point_at_with_chars( jni: &SharedJNIEnv<'mc>, arg0: Vec<u16>, arg1: i32, arg2: Option<i32>, ) -> Result<i32, Box<dyn Error>>
pub fn code_point_before_with_chars( jni: &SharedJNIEnv<'mc>, arg0: Vec<u16>, arg1: i32, arg2: Option<i32>, ) -> Result<i32, Box<dyn Error>>
pub fn offset_by_code_points_with_chars( jni: &SharedJNIEnv<'mc>, arg0: Vec<u16>, arg1: i32, arg2: i32, arg3: Option<i32>, arg4: Option<i32>, ) -> Result<i32, Box<dyn Error>>
pub fn to_lower_case_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<u16, Box<dyn Error>>
pub fn to_upper_case_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<i32, Box<dyn Error>>
pub fn is_bmp_code_point( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn describe_constable(&self) -> Result<JavaOptional<'mc>, Box<dyn Error>>
pub fn get_type_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<i32, Box<dyn Error>>
pub fn is_letter_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn is_letter_or_digit_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_valid_code_point( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn is_title_case_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_defined_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_ideographic( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn is_unicode_identifier_start_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_unicode_identifier_part_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_identifier_ignorable_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn to_title_case_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<u16, Box<dyn Error>>
pub fn digit_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, arg1: i32, ) -> Result<i32, Box<dyn Error>>
pub fn get_numeric_value_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<i32, Box<dyn Error>>
pub fn is_space_char_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_isocontrol_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn get_directionality_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<i8, Box<dyn Error>>
pub fn is_mirrored_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn is_surrogate_pair( jni: &SharedJNIEnv<'mc>, arg0: u16, arg1: u16, ) -> Result<bool, Box<dyn Error>>
pub fn char_count( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<i32, Box<dyn Error>>
pub fn is_java_letter( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_java_letter_or_digit( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn is_alphabetic( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>
pub fn is_space( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>
pub fn for_digit( jni: &SharedJNIEnv<'mc>, arg0: i32, arg1: i32, ) -> Result<u16, Box<dyn Error>>
pub fn code_point_of( jni: &SharedJNIEnv<'mc>, arg0: impl Into<String>, ) -> Result<i32, Box<dyn Error>>
pub fn instance_of(&self, other: impl Into<String>) -> Result<bool, Error>
Trait Implementations§
Source§impl<'mc> JNIInstantiatable<'mc> for JavaCharacter<'mc>
impl<'mc> JNIInstantiatable<'mc> for JavaCharacter<'mc>
Source§impl<'mc> JNIRaw<'mc> for JavaCharacter<'mc>
impl<'mc> JNIRaw<'mc> for JavaCharacter<'mc>
fn jni_ref(&self) -> SharedJNIEnv<'mc>
fn jni_object(&self) -> JObject<'mc>
Auto Trait Implementations§
impl<'mc> !Freeze for JavaCharacter<'mc>
impl<'mc> !RefUnwindSafe for JavaCharacter<'mc>
impl<'mc> !Send for JavaCharacter<'mc>
impl<'mc> !Sync for JavaCharacter<'mc>
impl<'mc> Unpin for JavaCharacter<'mc>
impl<'mc> UnwindSafe for JavaCharacter<'mc>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more