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 7443c0244..3c2703311 100644 --- a/app/src/main/java/io/legado/app/utils/StringExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/StringExtensions.kt @@ -55,6 +55,9 @@ fun String.splitNotBlank(regex: Regex, limit: Int = 0): Array = run { this.split(regex, limit).map { it.trim() }.filterNot { it.isBlank() }.toTypedArray() } +/** + * 将字符串拆分为单个字符,包含emoji + */ fun String.toStringArray(): Array { var codePointIndex = 0 return Array(codePointCount(0, length)) { @@ -66,14 +69,3 @@ fun String.toStringArray(): Array { } } -fun Char?.isHAN(): Boolean { - this ?: return false - val ub: Character.UnicodeBlock = Character.UnicodeBlock.of(this) ?: return false - return ub === Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS - || ub === Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A - || ub === Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B - || ub === Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C - || ub === Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D - || ub === Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS - || ub === Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT -}