Skip to content

Commit 8108d15

Browse files
committed
Revert "fast search in strings"
This reverts commit fd8beb3.
1 parent fd8beb3 commit 8108d15

4 files changed

Lines changed: 1 addition & 130 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
}
88

99
group = "net.sergeych"
10-
version = "1.4.4-SNAPSHOT"
10+
version = "1.4.3"
1111

1212
val serialization_version = "1.3.3"
1313

src/commonMain/kotlin/net/sergeych/mp_tools/search.kt

Lines changed: 0 additions & 101 deletions
This file was deleted.

src/commonMain/kotlin/net/sergeych/mp_tools/text_tools.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,4 @@ fun Number.withThousandsSeparator(separator: String=" "): String {
7575
}
7676
}
7777
return result.toString()
78-
}
79-
80-
private val idFirstChars = "_qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
81-
private val idChars = "1234567890$" + idFirstChars
82-
83-
/**
84-
* Generate a random string of a given length that contains only url-friendly characters
85-
* and starts with a letter of `_` character.
86-
*
87-
* If length < 1 returns empty string.
88-
*/
89-
fun randomId(length: Int): String {
90-
if( length < 1 ) return ""
91-
val result = mutableListOf(idFirstChars.random())
92-
var l = length
93-
while(--l > 0) result += idChars.random()
94-
return result.joinToString("")
9578
}

src/commonTest/kotlin/tools.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,6 @@ class TestTools {
7777
assertEquals(offset, haystack.indexOf(needle))
7878
}
7979

80-
@Test
81-
fun searchInString() {
82-
val offset = 1171
83-
val needle = "Fake vaccine kills"
84-
assertEquals(17, randomId(17).length)
85-
val haystack = randomId(offset) + needle + randomId(offset/3)
86-
assertEquals(offset, haystack.fastSearch(needle))
87-
assertEquals(offset, haystack.fastSearch(needle, offset/2))
88-
assertEquals(-1, haystack.fastSearch(needle, offset+1))
89-
}
90-
9180
@OptIn(ExperimentalCoroutinesApi::class)
9281
@Test
9382
fun reentrantMutex() = runTest {

0 commit comments

Comments
 (0)