diff --git a/core/src/commonMain/kotlin/maryk/core/processors/datastore/matchers/IndexPartialToMatch.kt b/core/src/commonMain/kotlin/maryk/core/processors/datastore/matchers/IndexPartialToMatch.kt index 6839f1040..a50ffc20d 100644 --- a/core/src/commonMain/kotlin/maryk/core/processors/datastore/matchers/IndexPartialToMatch.kt +++ b/core/src/commonMain/kotlin/maryk/core/processors/datastore/matchers/IndexPartialToMatch.kt @@ -2,7 +2,6 @@ package maryk.core.processors.datastore.matchers import maryk.core.processors.datastore.findByteIndexAndSizeByPartIndex import maryk.core.processors.datastore.findByteIndexByPartIndex -import maryk.lib.bytes.initString import maryk.lib.extensions.compare.matchPart sealed class IsIndexPartialToMatch { @@ -48,7 +47,7 @@ class IndexPartialToRegexMatch( /** Matches [bytes] to partial and returns true if matches */ override fun match(bytes: ByteArray, offset: Int, length: Int): Boolean { val (internalOffset, size) = findByteIndexAndSizeByPartIndex(indexableIndex, bytes, keySize) - return regex.matches(initString(bytes, offset + internalOffset, size)) + return regex.matches(bytes.decodeToString(offset + internalOffset, size)) } } diff --git a/lib/src/commonMain/kotlin/maryk/lib/bytes/String.kt b/lib/src/commonMain/kotlin/maryk/lib/bytes/String.kt index f0c526841..e8b5581ad 100644 --- a/lib/src/commonMain/kotlin/maryk/lib/bytes/String.kt +++ b/lib/src/commonMain/kotlin/maryk/lib/bytes/String.kt @@ -7,9 +7,6 @@ private const val MIN_SUPPLEMENTARY_CODE_POINT = 0x010000 expect fun fromCodePoint(value: Int): String expect fun codePointAt(string: String, index: Int): Int -fun initString(bytes: ByteArray, offset: Int, length: Int): String = - bytes.decodeToString(offset, offset + length) - fun initString(length: Int, reader: () -> Byte): String = if (length > recyclableByteArray.size) { ByteArray(length) { diff --git a/lib/src/commonTest/kotlin/maryk/lib/bytes/StringTest.kt b/lib/src/commonTest/kotlin/maryk/lib/bytes/StringTest.kt index f108d5566..0f56d62d8 100644 --- a/lib/src/commonTest/kotlin/maryk/lib/bytes/StringTest.kt +++ b/lib/src/commonTest/kotlin/maryk/lib/bytes/StringTest.kt @@ -25,16 +25,6 @@ class StringTest { } } - @Test - fun testBytesToString() { - for ((hex, value) in stringsAndBytes) { - val b = initByteArrayByHex(hex) - expect(value) { - initString(b, 0, b.size) - } - } - } - @Test fun testStringToBytes() { for ((hex, value) in stringsAndBytes) {