JavaCharacter

Struct JavaCharacter 

Source
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 char value cannot support supplementary characters. They treat char values from the surrogate ranges as undefined characters. For example, Character.isLetter('\uD840') returns false, even though this specific value if followed by any low-surrogate value in a string would represent a letter.
  • The methods that accept an int value support all Unicode characters, including supplementary characters. For example, Character.isLetter(0x2F81A) returns true because 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>

Source

pub fn new( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<JavaCharacter<'mc>, Box<dyn Error>>

👎Deprecated
Source

pub fn get_name( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<String, Box<dyn Error>>

Source

pub fn is_java_identifier_start_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_java_identifier_part_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn equals(&self, arg0: JObject<'mc>) -> Result<bool, Box<dyn Error>>

Source

pub fn to_string_with_char( jni: &SharedJNIEnv<'mc>, arg0: Option<u16>, ) -> Result<String, Box<dyn Error>>

Source

pub fn hash_code_with_char( jni: &SharedJNIEnv<'mc>, arg0: Option<u16>, ) -> Result<i32, Box<dyn Error>>

Source

pub fn reverse_bytes( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<u16, Box<dyn Error>>

Source

pub fn compare_to_with_character( &self, arg0: u16, ) -> Result<i32, Box<dyn Error>>

Source

pub fn is_digit_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_lower_case_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_upper_case_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_whitespace_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn compare( jni: &SharedJNIEnv<'mc>, arg0: u16, arg1: u16, ) -> Result<i32, Box<dyn Error>>

Source

pub fn char_value(&self) -> Result<u16, Box<dyn Error>>

Source

pub fn to_chars_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, arg1: Option<Vec<u16>>, arg2: Option<i32>, ) -> Result<i32, Box<dyn Error>>

Source

pub fn is_high_surrogate( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_low_surrogate( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_surrogate( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_supplementary_code_point( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn high_surrogate( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<u16, Box<dyn Error>>

Source

pub fn low_surrogate( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<u16, Box<dyn Error>>

Source

pub fn to_code_point( jni: &SharedJNIEnv<'mc>, arg0: u16, arg1: u16, ) -> Result<i32, Box<dyn Error>>

Source

pub fn code_point_at_with_chars( jni: &SharedJNIEnv<'mc>, arg0: Vec<u16>, arg1: i32, arg2: Option<i32>, ) -> Result<i32, Box<dyn Error>>

Source

pub fn code_point_before_with_chars( jni: &SharedJNIEnv<'mc>, arg0: Vec<u16>, arg1: i32, arg2: Option<i32>, ) -> Result<i32, Box<dyn Error>>

Source

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>>

Source

pub fn to_lower_case_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<u16, Box<dyn Error>>

Source

pub fn to_upper_case_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<i32, Box<dyn Error>>

Source

pub fn is_bmp_code_point( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn describe_constable(&self) -> Result<JavaOptional<'mc>, Box<dyn Error>>

Source

pub fn get_type_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<i32, Box<dyn Error>>

Source

pub fn is_letter_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_letter_or_digit_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_valid_code_point( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_title_case_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_defined_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_ideographic( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_unicode_identifier_start_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_unicode_identifier_part_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_identifier_ignorable_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn to_title_case_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<u16, Box<dyn Error>>

Source

pub fn digit_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, arg1: i32, ) -> Result<i32, Box<dyn Error>>

Source

pub fn get_numeric_value_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<i32, Box<dyn Error>>

Source

pub fn is_space_char_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_isocontrol_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn get_directionality_with_char( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<i8, Box<dyn Error>>

Source

pub fn is_mirrored_with_int( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_surrogate_pair( jni: &SharedJNIEnv<'mc>, arg0: u16, arg1: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn char_count( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<i32, Box<dyn Error>>

Source

pub fn is_java_letter( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_java_letter_or_digit( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_alphabetic( jni: &SharedJNIEnv<'mc>, arg0: i32, ) -> Result<bool, Box<dyn Error>>

Source

pub fn is_space( jni: &SharedJNIEnv<'mc>, arg0: u16, ) -> Result<bool, Box<dyn Error>>

Source

pub fn for_digit( jni: &SharedJNIEnv<'mc>, arg0: i32, arg1: i32, ) -> Result<u16, Box<dyn Error>>

Source

pub fn code_point_of( jni: &SharedJNIEnv<'mc>, arg0: impl Into<String>, ) -> Result<i32, Box<dyn Error>>

Source

pub fn instance_of(&self, other: impl Into<String>) -> Result<bool, Error>

Trait Implementations§

Source§

impl<'mc> JNIInstantiatable<'mc> for JavaCharacter<'mc>

Source§

fn from_raw( env: &SharedJNIEnv<'mc>, obj: JObject<'mc>, ) -> Result<Self, Box<dyn Error>>

Source§

impl<'mc> JNIRaw<'mc> for JavaCharacter<'mc>

Source§

fn jni_ref(&self) -> SharedJNIEnv<'mc>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more