[O] More optimization for CharSequence.lines()

This commit is contained in:
Azalea
2024-03-19 21:26:55 -07:00
committed by GitHub
parent 29c6445084
commit 2263dd3761
+2 -2
View File
@@ -1403,14 +1403,14 @@ public inline fun CharSequence.splitToSequence(regex: Regex, limit: Int = 0): Se
*
* The lines returned do not include terminating line separators.
*/
public fun CharSequence.lineSequence(): Sequence<String> = toString().replace("\r\n", "\n").splitToSequence('\r', '\n')
public fun CharSequence.lineSequence(): Sequence<String> = toString().replace("\r\n", "\n").replace('\r', '\n').splitToSequence('\n')
/**
* Splits this char sequence to a list of lines delimited by any of the following character sequences: CRLF, LF or CR.
*
* The lines returned do not include terminating line separators.
*/
public fun CharSequence.lines(): List<String> = toString().replace("\r\n", "\n").split('\r', '\n')
public fun CharSequence.lines(): List<String> = toString().replace("\r\n", "\n").replace('\r', '\n').split('\n')
/**
* Returns `true` if the contents of this char sequence are equal to the contents of the specified [other],