core-ktx / androidx.text / kotlin.CharSequence

Extensions for kotlin.CharSequence

isDigitsOnly

fun CharSequence.isDigitsOnly(): Boolean

Returns whether the given CharSequence contains only digits.

toSpannable

fun CharSequence.toSpannable(): Spannable

Returns a new Spannable from CharSequence, or the source itself if it is already an instance of SpannableString.

toSpanned

fun CharSequence.toSpanned(): Spanned

Returns a new Spanned from CharSequence, or the source itself if it is already an instance of SpannedString.

trimmedLength

fun CharSequence.trimmedLength(): Int

Returns the length that the specified CharSequence would have if spaces and ASCII control characters were trimmed from the start and end, as by String.trim.