SpannableStringKt

public final class SpannableStringKt


Summary

Public methods

static final void

Clear all spans from this text.

static final void
SpannableStringKt.set(
    @NonNull Spannable receiver,
    int start,
    int end,
    @NonNull Object span
)

Add span to the range start…end of the text.

static final void
SpannableStringKt.set(
    @NonNull Spannable receiver,
    @NonNull IntRange range,
    @NonNull Object span
)

Add span to the range of the text.

static final @NonNull Spannable

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

Public methods

SpannableStringKt.clearSpans

@NonNull
public static final void SpannableStringKt.clearSpans(@NonNull Spannable receiver)

Clear all spans from this text.

SpannableStringKt.set

@NonNull
public static final void SpannableStringKt.set(
    @NonNull Spannable receiver,
    int start,
    int end,
    @NonNull Object span
)

Add span to the range start…end of the text.

val s = "Hello, World!".toSpannable()
s[0, 5] = UnderlineSpan()

Note: The end value is exclusive.

See also
setSpan

SpannableStringKt.set

@NonNull
public static final void SpannableStringKt.set(
    @NonNull Spannable receiver,
    @NonNull IntRange range,
    @NonNull Object span
)

Add span to the range of the text.

val s = "Hello, World!".toSpannable()
s[0..5] = UnderlineSpan()

Note: The range end value is exclusive.

See also
setSpan

SpannableStringKt.toSpannable

@NonNull
public static final Spannable SpannableStringKt.toSpannable(@NonNull CharSequence receiver)

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