Rollup merge of #95708 - fee1-dead:doc_whitespace_trim, r=Dylan-DPC
Update documentation for `trim*` and `is_whitespace` to include newlines
This commit is contained in:
commit
eeabdec14c
2 changed files with 11 additions and 8 deletions
|
@ -804,6 +804,9 @@ impl char {
|
||||||
/// ```
|
/// ```
|
||||||
/// assert!(' '.is_whitespace());
|
/// assert!(' '.is_whitespace());
|
||||||
///
|
///
|
||||||
|
/// // line break
|
||||||
|
/// assert!('\n'.is_whitespace());
|
||||||
|
///
|
||||||
/// // a non-breaking space
|
/// // a non-breaking space
|
||||||
/// assert!('\u{A0}'.is_whitespace());
|
/// assert!('\u{A0}'.is_whitespace());
|
||||||
///
|
///
|
||||||
|
|
|
@ -1832,14 +1832,14 @@ impl str {
|
||||||
/// Returns a string slice with leading and trailing whitespace removed.
|
/// Returns a string slice with leading and trailing whitespace removed.
|
||||||
///
|
///
|
||||||
/// 'Whitespace' is defined according to the terms of the Unicode Derived
|
/// 'Whitespace' is defined according to the terms of the Unicode Derived
|
||||||
/// Core Property `White_Space`.
|
/// Core Property `White_Space`, which includes newlines.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let s = " Hello\tworld\t";
|
/// let s = "\n Hello\tworld\t\n";
|
||||||
///
|
///
|
||||||
/// assert_eq!("Hello\tworld", s.trim());
|
/// assert_eq!("Hello\tworld", s.trim());
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -1855,7 +1855,7 @@ impl str {
|
||||||
/// Returns a string slice with leading whitespace removed.
|
/// Returns a string slice with leading whitespace removed.
|
||||||
///
|
///
|
||||||
/// 'Whitespace' is defined according to the terms of the Unicode Derived
|
/// 'Whitespace' is defined according to the terms of the Unicode Derived
|
||||||
/// Core Property `White_Space`.
|
/// Core Property `White_Space`, which includes newlines.
|
||||||
///
|
///
|
||||||
/// # Text directionality
|
/// # Text directionality
|
||||||
///
|
///
|
||||||
|
@ -1869,8 +1869,8 @@ impl str {
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let s = " Hello\tworld\t";
|
/// let s = "\n Hello\tworld\t\n";
|
||||||
/// assert_eq!("Hello\tworld\t", s.trim_start());
|
/// assert_eq!("Hello\tworld\t\n", s.trim_start());
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Directionality:
|
/// Directionality:
|
||||||
|
@ -1894,7 +1894,7 @@ impl str {
|
||||||
/// Returns a string slice with trailing whitespace removed.
|
/// Returns a string slice with trailing whitespace removed.
|
||||||
///
|
///
|
||||||
/// 'Whitespace' is defined according to the terms of the Unicode Derived
|
/// 'Whitespace' is defined according to the terms of the Unicode Derived
|
||||||
/// Core Property `White_Space`.
|
/// Core Property `White_Space`, which includes newlines.
|
||||||
///
|
///
|
||||||
/// # Text directionality
|
/// # Text directionality
|
||||||
///
|
///
|
||||||
|
@ -1908,8 +1908,8 @@ impl str {
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let s = " Hello\tworld\t";
|
/// let s = "\n Hello\tworld\t\n";
|
||||||
/// assert_eq!(" Hello\tworld", s.trim_end());
|
/// assert_eq!("\n Hello\tworld", s.trim_end());
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Directionality:
|
/// Directionality:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue