File tree 2 files changed +42
-2
lines changed
2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -2122,6 +2122,48 @@ impl str {
2122
2122
unsafe { String :: from_utf8_unchecked ( buf) }
2123
2123
}
2124
2124
2125
+ /// Returns true if this `str` is entirely whitespace, and false otherwise.
2126
+ ///
2127
+ /// 'Whitespace' is defined according to the terms of the Unicode Derived Core
2128
+ /// Property `White_Space`.
2129
+ ///
2130
+ /// # Examples
2131
+ ///
2132
+ /// Basic usage:
2133
+ ///
2134
+ /// ```
2135
+ /// assert!(" \t ".is_whitespace());
2136
+ ///
2137
+ /// // a non-breaking space
2138
+ /// assert!("\u{A0}".is_whitespace());
2139
+ ///
2140
+ /// assert!(!" 越".is_whitespace());
2141
+ /// ```
2142
+ #[ stable( feature = "unicode_methods_on_intrinsics" , since = "1.27.0" ) ]
2143
+ #[ inline]
2144
+ pub fn is_whitespace ( & self ) -> bool {
2145
+ UnicodeStr :: is_whitespace ( self )
2146
+ }
2147
+
2148
+ /// Returns true if this `str` is entirely alphanumeric, and false otherwise.
2149
+ ///
2150
+ /// 'Alphanumeric'-ness is defined in terms of the Unicode General Categories
2151
+ /// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
2152
+ ///
2153
+ /// # Examples
2154
+ ///
2155
+ /// Basic usage:
2156
+ ///
2157
+ /// ```
2158
+ /// assert!("٣7৬Kو藏".is_alphanumeric());
2159
+ /// assert!(!"¾①".is_alphanumeric());
2160
+ /// ```
2161
+ #[ stable( feature = "unicode_methods_on_intrinsics" , since = "1.27.0" ) ]
2162
+ #[ inline]
2163
+ pub fn is_alphanumeric ( & self ) -> bool {
2164
+ UnicodeStr :: is_alphanumeric ( self )
2165
+ }
2166
+
2125
2167
/// Checks if all characters in this string are within the ASCII range.
2126
2168
///
2127
2169
/// # Examples
Original file line number Diff line number Diff line change @@ -406,8 +406,6 @@ pub fn make_test(s: &str,
406
406
407
407
// FIXME(aburka): use a real parser to deal with multiline attributes
408
408
fn partition_source ( s : & str ) -> ( String , String ) {
409
- use std_unicode:: str:: UnicodeStr ;
410
-
411
409
let mut after_header = false ;
412
410
let mut before = String :: new ( ) ;
413
411
let mut after = String :: new ( ) ;
You can’t perform that action at this time.
0 commit comments