@@ -2199,153 +2199,6 @@ impl str {
21992199 let me = unsafe { self . as_bytes_mut ( ) } ;
22002200 me. make_ascii_lowercase ( )
22012201 }
2202-
2203- /// Checks if all characters of this string are ASCII alphabetic
2204- /// characters:
2205- ///
2206- /// - U+0041 'A' ... U+005A 'Z', or
2207- /// - U+0061 'a' ... U+007A 'z'.
2208- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2209- #[ inline]
2210- pub fn is_ascii_alphabetic ( & self ) -> bool {
2211- self . bytes ( ) . all ( |b| b. is_ascii_alphabetic ( ) )
2212- }
2213-
2214- /// Checks if all characters of this string are ASCII uppercase characters:
2215- /// U+0041 'A' ... U+005A 'Z'.
2216- ///
2217- /// # Example
2218- ///
2219- /// ```
2220- /// #![feature(ascii_ctype)]
2221- ///
2222- /// // Only ascii uppercase characters
2223- /// assert!("HELLO".is_ascii_uppercase());
2224- ///
2225- /// // While all characters are ascii, 'y' and 'e' are not uppercase
2226- /// assert!(!"Bye".is_ascii_uppercase());
2227- ///
2228- /// // While all characters are uppercase, 'Ü' is not ascii
2229- /// assert!(!"TSCHÜSS".is_ascii_uppercase());
2230- /// ```
2231- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2232- #[ inline]
2233- pub fn is_ascii_uppercase ( & self ) -> bool {
2234- self . bytes ( ) . all ( |b| b. is_ascii_uppercase ( ) )
2235- }
2236-
2237- /// Checks if all characters of this string are ASCII lowercase characters:
2238- /// U+0061 'a' ... U+007A 'z'.
2239- ///
2240- /// # Example
2241- ///
2242- /// ```
2243- /// #![feature(ascii_ctype)]
2244- ///
2245- /// // Only ascii uppercase characters
2246- /// assert!("hello".is_ascii_lowercase());
2247- ///
2248- /// // While all characters are ascii, 'B' is not lowercase
2249- /// assert!(!"Bye".is_ascii_lowercase());
2250- ///
2251- /// // While all characters are lowercase, 'Ü' is not ascii
2252- /// assert!(!"tschüss".is_ascii_lowercase());
2253- /// ```
2254- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2255- #[ inline]
2256- pub fn is_ascii_lowercase ( & self ) -> bool {
2257- self . bytes ( ) . all ( |b| b. is_ascii_lowercase ( ) )
2258- }
2259-
2260- /// Checks if all characters of this string are ASCII alphanumeric
2261- /// characters:
2262- ///
2263- /// - U+0041 'A' ... U+005A 'Z', or
2264- /// - U+0061 'a' ... U+007A 'z', or
2265- /// - U+0030 '0' ... U+0039 '9'.
2266- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2267- #[ inline]
2268- pub fn is_ascii_alphanumeric ( & self ) -> bool {
2269- self . bytes ( ) . all ( |b| b. is_ascii_alphanumeric ( ) )
2270- }
2271-
2272- /// Checks if all characters of this string are ASCII decimal digit:
2273- /// U+0030 '0' ... U+0039 '9'.
2274- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2275- #[ inline]
2276- pub fn is_ascii_digit ( & self ) -> bool {
2277- self . bytes ( ) . all ( |b| b. is_ascii_digit ( ) )
2278- }
2279-
2280- /// Checks if all characters of this string are ASCII hexadecimal digits:
2281- ///
2282- /// - U+0030 '0' ... U+0039 '9', or
2283- /// - U+0041 'A' ... U+0046 'F', or
2284- /// - U+0061 'a' ... U+0066 'f'.
2285- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2286- #[ inline]
2287- pub fn is_ascii_hexdigit ( & self ) -> bool {
2288- self . bytes ( ) . all ( |b| b. is_ascii_hexdigit ( ) )
2289- }
2290-
2291- /// Checks if all characters of this string are ASCII punctuation
2292- /// characters:
2293- ///
2294- /// - U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /`, or
2295- /// - U+003A ... U+0040 `: ; < = > ? @`, or
2296- /// - U+005B ... U+0060 ``[ \ ] ^ _ ` ``, or
2297- /// - U+007B ... U+007E `{ | } ~`
2298- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2299- #[ inline]
2300- pub fn is_ascii_punctuation ( & self ) -> bool {
2301- self . bytes ( ) . all ( |b| b. is_ascii_punctuation ( ) )
2302- }
2303-
2304- /// Checks if all characters of this string are ASCII graphic characters:
2305- /// U+0021 '@' ... U+007E '~'.
2306- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2307- #[ inline]
2308- pub fn is_ascii_graphic ( & self ) -> bool {
2309- self . bytes ( ) . all ( |b| b. is_ascii_graphic ( ) )
2310- }
2311-
2312- /// Checks if all characters of this string are ASCII whitespace characters:
2313- /// U+0020 SPACE, U+0009 HORIZONTAL TAB, U+000A LINE FEED,
2314- /// U+000C FORM FEED, or U+000D CARRIAGE RETURN.
2315- ///
2316- /// Rust uses the WhatWG Infra Standard's [definition of ASCII
2317- /// whitespace][infra-aw]. There are several other definitions in
2318- /// wide use. For instance, [the POSIX locale][pct] includes
2319- /// U+000B VERTICAL TAB as well as all the above characters,
2320- /// but—from the very same specification—[the default rule for
2321- /// "field splitting" in the Bourne shell][bfs] considers *only*
2322- /// SPACE, HORIZONTAL TAB, and LINE FEED as whitespace.
2323- ///
2324- /// If you are writing a program that will process an existing
2325- /// file format, check what that format's definition of whitespace is
2326- /// before using this function.
2327- ///
2328- /// [infra-aw]: https://infra.spec.whatwg.org/#ascii-whitespace
2329- /// [pct]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_01
2330- /// [bfs]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05
2331- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2332- #[ inline]
2333- pub fn is_ascii_whitespace ( & self ) -> bool {
2334- self . bytes ( ) . all ( |b| b. is_ascii_whitespace ( ) )
2335- }
2336-
2337- /// Checks if all characters of this string are ASCII control characters:
2338- ///
2339- /// - U+0000 NUL ... U+001F UNIT SEPARATOR, or
2340- /// - U+007F DELETE.
2341- ///
2342- /// Note that most ASCII whitespace characters are control
2343- /// characters, but SPACE is not.
2344- #[ unstable( feature = "ascii_ctype" , issue = "39658" ) ]
2345- #[ inline]
2346- pub fn is_ascii_control ( & self ) -> bool {
2347- self . bytes ( ) . all ( |b| b. is_ascii_control ( ) )
2348- }
23492202}
23502203
23512204/// Converts a boxed slice of bytes to a boxed string slice without checking
0 commit comments