[K/N] Commonize String.regionMatches function

As a part of efforts to stabilize K/N stdlib.
This commit is contained in:
Abduqodiri Qurbonzoda
2023-04-08 22:45:12 +03:00
committed by Space Team
parent 0d31b0d12c
commit 7eba68e62b
7 changed files with 74 additions and 4 deletions
@@ -649,7 +649,8 @@ public actual fun CharSequence.regionMatches(thisOffset: Int, other: CharSequenc
* @param otherOffset the start offset in the other string of the substring to compare.
* @param length the length of the substring to compare.
*/
public fun String.regionMatches(thisOffset: Int, other: String, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean =
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun String.regionMatches(thisOffset: Int, other: String, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean =
if (!ignoreCase)
(this as java.lang.String).regionMatches(thisOffset, other, otherOffset, length)
else