diff --git a/app/src/main/java/io/legado/app/utils/StringExtensions.kt b/app/src/main/java/io/legado/app/utils/StringExtensions.kt index 9daa31c8a..ae881eb64 100644 --- a/app/src/main/java/io/legado/app/utils/StringExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/StringExtensions.kt @@ -49,16 +49,14 @@ fun String.splitNotBlank(regex: Regex, limit: Int = 0): Array = run { } fun String.toStringArray(): Array { - val strArray = Array(this.codePointCount(0, this.length)) { "" } var codePointIndex = 0 - for (i in strArray.indices) { - strArray[i] = substring( + return Array(codePointCount(0, length)) { + substring( codePointIndex, offsetByCodePoints(codePointIndex, 1) .apply { codePointIndex = this } ) } - return strArray } fun Char?.isHAN(): Boolean {