mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-27 22:34:14 +00:00
Rollup merge of #31202 - steveklabnik:gh30459, r=alexcrichton
Fixes #30459 Fun fact: i wanted to write "Arabic" and "Hebrew" in Arabic and Hebrew, but vim kept doing the copy/paste in the wrong direction.
This commit is contained in:
commit
7097d29411
@ -1511,6 +1511,13 @@ impl str {
|
||||
/// 'Whitespace' is defined according to the terms of the Unicode Derived
|
||||
/// Core Property `White_Space`.
|
||||
///
|
||||
/// # Text directionality
|
||||
///
|
||||
/// A string is a sequence of bytes. 'Left' in this context means the first
|
||||
/// position of that byte string; for a language like Arabic or Hebrew
|
||||
/// which are 'right to left' rather than 'left to right', this will be
|
||||
/// the _right_ side, not the left.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
@ -1520,6 +1527,16 @@ impl str {
|
||||
///
|
||||
/// assert_eq!("Hello\tworld\t", s.trim_left());
|
||||
/// ```
|
||||
///
|
||||
/// Directionality:
|
||||
///
|
||||
/// ```
|
||||
/// let s = " English";
|
||||
/// assert!(Some('E') == s.trim_left().chars().next());
|
||||
///
|
||||
/// let s = " עברית";
|
||||
/// assert!(Some('ע') == s.trim_left().chars().next());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn trim_left(&self) -> &str {
|
||||
UnicodeStr::trim_left(self)
|
||||
@ -1530,6 +1547,13 @@ impl str {
|
||||
/// 'Whitespace' is defined according to the terms of the Unicode Derived
|
||||
/// Core Property `White_Space`.
|
||||
///
|
||||
/// # Text directionality
|
||||
///
|
||||
/// A string is a sequence of bytes. 'Right' in this context means the last
|
||||
/// position of that byte string; for a language like Arabic or Hebrew
|
||||
/// which are 'right to left' rather than 'left to right', this will be
|
||||
/// the _left_ side, not the right.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
@ -1539,6 +1563,16 @@ impl str {
|
||||
///
|
||||
/// assert_eq!(" Hello\tworld", s.trim_right());
|
||||
/// ```
|
||||
///
|
||||
/// Directionality:
|
||||
///
|
||||
/// ```
|
||||
/// let s = "English ";
|
||||
/// assert!(Some('h') == s.trim_right().chars().rev().next());
|
||||
///
|
||||
/// let s = "עברית ";
|
||||
/// assert!(Some('ת') == s.trim_right().chars().rev().next());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn trim_right(&self) -> &str {
|
||||
UnicodeStr::trim_right(self)
|
||||
@ -1584,6 +1618,13 @@ impl str {
|
||||
///
|
||||
/// [`char`]: primitive.char.html
|
||||
///
|
||||
/// # Text directionality
|
||||
///
|
||||
/// A string is a sequence of bytes. 'Left' in this context means the first
|
||||
/// position of that byte string; for a language like Arabic or Hebrew
|
||||
/// which are 'right to left' rather than 'left to right', this will be
|
||||
/// the _right_ side, not the left.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
@ -1608,6 +1649,13 @@ impl str {
|
||||
///
|
||||
/// [`char`]: primitive.char.html
|
||||
///
|
||||
/// # Text directionality
|
||||
///
|
||||
/// A string is a sequence of bytes. 'Right' in this context means the last
|
||||
/// position of that byte string; for a language like Arabic or Hebrew
|
||||
/// which are 'right to left' rather than 'left to right', this will be
|
||||
/// the _left_ side, not the right.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Simple patterns:
|
||||
|
Loading…
Reference in New Issue
Block a user