From 051fcc090a1b1817aed64f19106f0f94d630146f Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 4 Mar 2020 12:05:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/utils/StringExtensions.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 {