File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -902,6 +902,12 @@ impl str {
902902 ///
903903 /// assert_eq!(None, iter.next());
904904 /// ```
905+ ///
906+ /// If the string is empty or all whitespace, the iterator yields no string slices:
907+ /// ```
908+ /// assert_eq!("".split_whitespace().next(), None);
909+ /// assert_eq!(" ".split_whitespace().next(), None);
910+ /// ```
905911 #[ must_use = "this returns the split string as an iterator, \
906912 without modifying the original"]
907913 #[ stable( feature = "split_whitespace" , since = "1.1.0" ) ]
@@ -946,6 +952,12 @@ impl str {
946952 ///
947953 /// assert_eq!(None, iter.next());
948954 /// ```
955+ ///
956+ /// If the string is empty or all ASCII whitespace, the iterator yields no string slices:
957+ /// ```
958+ /// assert_eq!("".split_ascii_whitespace().next(), None);
959+ /// assert_eq!(" ".split_ascii_whitespace().next(), None);
960+ /// ```
949961 #[ must_use = "this returns the split string as an iterator, \
950962 without modifying the original"]
951963 #[ stable( feature = "split_ascii_whitespace" , since = "1.34.0" ) ]
You can’t perform that action at this time.
0 commit comments