Commit 069753e9 authored by Him188's avatar Him188

Make chinese letter length estimating more safer

parent 7abfa5a0
...@@ -32,7 +32,7 @@ internal fun Int.toIpV4AddressString(): String { ...@@ -32,7 +32,7 @@ internal fun Int.toIpV4AddressString(): String {
} }
internal fun String.chineseLength(upTo: Int): Int { internal fun String.chineseLength(upTo: Int): Int {
return this.sumUpTo(upTo) { if (it in '\u0391'..'\uFFE5') 3 else 1 } return this.sumUpTo(upTo) { if (it in '\u0391'..'\uFFE5') 4 else 1 }
} }
internal fun MessageChain.estimateLength(upTo: Int = Int.MAX_VALUE): Int = internal fun MessageChain.estimateLength(upTo: Int = Int.MAX_VALUE): Int =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment