Rename split method to splitBy and revive old split implementation interpreting parameter as regex to provide the migration path.

This commit is contained in:
Ilya Gorbunov
2015-03-26 22:49:07 +03:00
committed by Ilya Gorbunov
parent b10d869cd7
commit b3165ac771
5 changed files with 24 additions and 8 deletions
+4 -4
View File
@@ -292,14 +292,14 @@ class StringTest {
test fun split() {
assertEquals(listOf(""), "".split(";"))
assertEquals(listOf(""), "".splitBy(";"))
assertEquals(listOf("test"), "test".split(*charArray()), "empty list of delimiters, none matched -> entire string returned")
assertEquals(listOf("test"), "test".split(*array<String>()), "empty list of delimiters, none matched -> entire string returned")
assertEquals(listOf("test"), "test".splitBy(*array<String>()), "empty list of delimiters, none matched -> entire string returned")
assertEquals(listOf("abc", "def", "123;456"), "abc;def,123;456".split(';', ',', limit = 3))
assertEquals(listOf("abc", "def", "123", "456"), "abc<BR>def<br>123<bR>456".split("<BR>", ignoreCase = true))
assertEquals(listOf("abc", "def", "123", "456"), "abc<BR>def<br>123<bR>456".splitBy("<BR>", ignoreCase = true))
assertEquals(listOf("abc", "def", "123", "456"), "abc=-def==123=456".split("==", "=-", "="))
assertEquals(listOf("abc", "def", "123", "456"), "abc=-def==123=456".splitBy("==", "=-", "="))
}
test fun splitToLines() {