We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
lines
1 parent d682af8 commit 4996edcCopy full SHA for 4996edc
library/core/src/str/mod.rs
@@ -1251,6 +1251,8 @@ impl str {
1251
/// ending will return the same lines as an otherwise identical string
1252
/// without a final line ending.
1253
///
1254
+ /// An empty string returns no lines.
1255
+ ///
1256
/// # Examples
1257
1258
/// Basic usage:
@@ -1281,6 +1283,15 @@ impl str {
1281
1283
1282
1284
/// assert_eq!(None, lines.next());
1285
/// ```
1286
1287
+ /// An empty string returns no lines:
1288
1289
+ /// ```
1290
+ /// let text = "";
1291
+ /// let mut lines = text.lines();
1292
1293
+ /// assert_eq!(lines.next(), None);
1294
1295
#[stable(feature = "rust1", since = "1.0.0")]
1296
#[inline]
1297
pub fn lines(&self) -> Lines<'_> {
0 commit comments