Modify split(String) usages within stdlib.
This commit is contained in:
committed by
Ilya Gorbunov
parent
6f7a4d8429
commit
abdac27b61
@@ -121,7 +121,7 @@ public fun Node.previousElements(): List<Element> = previousSiblings().filterIsI
|
|||||||
public var Element.classSet: MutableSet<String>
|
public var Element.classSet: MutableSet<String>
|
||||||
get() {
|
get() {
|
||||||
val answer = LinkedHashSet<String>()
|
val answer = LinkedHashSet<String>()
|
||||||
val array = this.classes.split("""\s""")
|
val array = this.classes.split("""\s""".toRegex())
|
||||||
for (s in array) {
|
for (s in array) {
|
||||||
if (s.length() > 0) {
|
if (s.length() > 0) {
|
||||||
answer.add(s)
|
answer.add(s)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public fun File.filePathComponents(): FilePathComponents {
|
|||||||
// Split not only by / or \, but also by //, ///, \\, \\\, etc.
|
// Split not only by / or \, but also by //, ///, \\, \\\, etc.
|
||||||
val list = if (rootName.length() > 0 && subPath.isEmpty()) listOf() else
|
val list = if (rootName.length() > 0 && subPath.isEmpty()) listOf() else
|
||||||
// Looks awful but we split just by /+ or \+ depending on OS
|
// Looks awful but we split just by /+ or \+ depending on OS
|
||||||
subPath.split("""\Q${File.separatorChar}\E+""").toList().map { it -> File(it) }
|
subPath.split("""\Q${File.separatorChar}\E+""".toRegex()).toList().map { it -> File(it) }
|
||||||
return FilePathComponents(rootName, list)
|
return FilePathComponents(rootName, list)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user