feat: 优化代码

pull/133/head
kunfei 5 years ago
parent 394c80f005
commit 051fcc090a
  1. 6
      app/src/main/java/io/legado/app/utils/StringExtensions.kt

@ -49,16 +49,14 @@ fun String.splitNotBlank(regex: Regex, limit: Int = 0): Array<String> = run {
}
fun String.toStringArray(): Array<String> {
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 {

Loading…
Cancel
Save