2022-04-10 Android Html.from() 末尾大量空白去除 Android Html.from() 末尾大量空白去除解决方法12345678910111213141516171819202122232425/** * Trims trailing whitespace. * * Removes any of these characters: * - 0009, HORIZONTAL TABULATION * - 000A, LINE FEED * - 000B, VERTICAL TABULATION * - 000C, FORM FEED * - 000D, CARRIAGE RETURN * - 001C, FILE SEPARATOR * - 001D, GROUP SEPARATOR * - 001E, RECORD SEPARATOR * - 001F, UNIT SEPARATOR * * @return "" if source is null, otherwise string with all trailing whitespace removed */private fun CharSequence.trimTrailingWhitespace(): CharSequence { var i = length // loop back to the first non-whitespace character while (--i >= 0 && Character.isWhitespace(this[i])) { continue } return this.subSequence(0, i + 1)} Older Android Apk大小优化常用方案整理