summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsom-snytt <som.snytt@gmail.com>2016-05-17 03:07:31 -0700
committerLukas Rytz <lukas.rytz@typesafe.com>2016-05-17 12:07:31 +0200
commit4d5589ca63686472b090958a0984f061baf2af8f (patch)
treeb5776162009652591aef281684f65b26c09bf0c9
parent061acd3ce9e1af12695b7387b42218fc99a8d91b (diff)
downloadscala-4d5589ca63686472b090958a0984f061baf2af8f.tar.gz
scala-4d5589ca63686472b090958a0984f061baf2af8f.tar.bz2
scala-4d5589ca63686472b090958a0984f061baf2af8f.zip
SI-9773 Fix doc for "".lines (#5161)
An empty string yields an empty iterator.
-rw-r--r--src/library/scala/collection/immutable/StringLike.scala16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/library/scala/collection/immutable/StringLike.scala b/src/library/scala/collection/immutable/StringLike.scala
index d92db68912..8a9df0e862 100644
--- a/src/library/scala/collection/immutable/StringLike.scala
+++ b/src/library/scala/collection/immutable/StringLike.scala
@@ -100,11 +100,13 @@ self =>
/** Return all lines in this string in an iterator, including trailing
* line end characters.
*
- * The number of strings returned is one greater than the number of line
- * end characters in this string. For an empty string, a single empty
- * line is returned. A line end character is one of
- * - `LF` - line feed (`0x0A` hex)
- * - `FF` - form feed (`0x0C` hex)
+ * This method is analogous to `s.split(EOL).toIterator`,
+ * except that any existing line endings are preserved in the result strings,
+ * and the empty string yields an empty iterator.
+ *
+ * A line end character is one of
+ * - `LF` - line feed (`0x0A`)
+ * - `FF` - form feed (`0x0C`)
*/
def linesWithSeparators: Iterator[String] = new AbstractIterator[String] {
val str = self.toString
@@ -121,14 +123,14 @@ self =>
}
/** Return all lines in this string in an iterator, excluding trailing line
- * end characters, i.e., apply `.stripLineEnd` to all lines
+ * end characters; i.e., apply `.stripLineEnd` to all lines
* returned by `linesWithSeparators`.
*/
def lines: Iterator[String] =
linesWithSeparators map (line => new WrappedString(line).stripLineEnd)
/** Return all lines in this string in an iterator, excluding trailing line
- * end characters, i.e., apply `.stripLineEnd` to all lines
+ * end characters; i.e., apply `.stripLineEnd` to all lines
* returned by `linesWithSeparators`.
*/
@deprecated("Use `lines` instead.","2.11.0")