From 663f502a92f8120d43722fc9c84b580b60d3660c Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 14 Aug 2020 11:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/utils/StringExtensions.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 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 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 -}