# AnnotatedString

Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/AnnotatedString.kt+class:androidx.compose.ui.text.AnnotatedString) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  class AnnotatedString : CharSequence
  ```

*** ** * ** ***

Text with multiple styles.

`https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle` applies character-level styling (such as color, font, or decorations) to a range of text. `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle` applies paragraph-level layout configuration (such as alignment, line height, or indent) to the entire paragraph.

Use `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Builder` to construct.

### Precedence and Merging Rules

When multiple `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle`s are applied to overlapping ranges, they are merged character by character:

- Styles appearing later in the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#spanStyles()` list take precedence and overwrite matching properties of earlier styles.

- Any unspecified properties (such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Unspecified()` or `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit#Unspecified()`) do not overwrite prior styles, retaining the value from the previous style in the stack or the default text style.

### Paragraphs Arrangement

`https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle`s can be applied to parts of the text. However, paragraph ranges must not partially overlap. They can only be nested or fully overlapping. If ranges are invalid, an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown.

Valid arrangements (nested or non-overlapping):

- Non-overlapping: `\[abc\](def)` (two separate paragraphs)

- Nested: `\[abc(def)ghi\]` (inner paragraph `(def)` nested inside outer `\[abc...ghi\]`)

- Fully overlapping: `\[(abc)\]`

Invalid arrangement (partial overlap):

- Overlapping: `\[abc(def\]ghi)` (inner starts inside outer, but ends outside - invalid!)

Gaps between paragraph styles are filled with default styles. Nested paragraphs are split and merged with parent styles.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle` |   |

## Summary

| ### Nested types |
|---|
| `sealed interface https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Annotation` Defines annotations that specify additional information to apply to ranges of text within the given AnnotatedString. |
| `class https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Builder : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.text/-appendable/index.html` Builds an `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` incrementally. |
| `class https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Builder.BulletScope` Scope for a bullet list |
| `object https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Companion` |
| `data class https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>` The information attached on the text such as a `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle`. |

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/saveable/Saver<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString, *>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#Saver()` The default `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#Saver()` implementation for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`. | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#AnnotatedString(kotlin.String,kotlin.collections.List)( text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, annotations: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Annotation>> )` Creates an `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` with annotations. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#AnnotatedString(kotlin.String,kotlin.collections.List,kotlin.collections.List)( text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, spanStyles: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle>>, paragraphStyles: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle>> )` Creates an `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` with styles. | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#flatMapAnnotations(kotlin.Function1)( transform: (https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Annotation>) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Annotation>> )` Returns a new `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` where a list of annotations contains all elements yielded from results `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#flatMapAnnotations(kotlin.Function1)` function being invoked on each element of original annotations list. | Cmn |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#get(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation>>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getLinkAnnotations(kotlin.Int,kotlin.Int)(start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Query all of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation`s attached on this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html>>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getStringAnnotations(kotlin.Int,kotlin.Int)(start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Query all of the string annotations attached on this AnnotatedString. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html>>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getStringAnnotations(kotlin.String,kotlin.Int,kotlin.Int)(tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Query the string annotations attached on this AnnotatedString. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TtsAnnotation>>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getTtsAnnotations(kotlin.Int,kotlin.Int)(start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Query all of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TtsAnnotation`s attached on this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/UrlAnnotation>>` | `@https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ExperimentalTextApi [getUrlAnnotations](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getUrlAnnotations(kotlin.Int,kotlin.Int))(start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** Use LinkAnnotation API instead | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#hasEqualAnnotations(androidx.compose.ui.text.AnnotatedString)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString)` Compare the annotations between this and another AnnotatedString. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#hasLinkAnnotations(kotlin.Int,kotlin.Int)(start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns true if `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getLinkAnnotations(kotlin.Int,kotlin.Int)` with the same parameters would return a non-empty list | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#hasStringAnnotations(kotlin.String,kotlin.Int,kotlin.Int)(tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns true if `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getStringAnnotations(kotlin.String,kotlin.Int,kotlin.Int)` with the same parameters would return a non-empty list | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#hashCode()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#mapAnnotations(kotlin.Function1)( transform: (https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Annotation>) -> https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Annotation> )` Returns a new `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` where a list of annotations contains the results of applying the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#mapAnnotations(kotlin.Function1)` function to each element in the original annotations list. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#plus(androidx.compose.ui.text.AnnotatedString)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString)` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#subSequence(androidx.compose.ui.text.TextRange)(range: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextRange)` Return a substring for the AnnotatedString and include the styles in the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#subSequence(androidx.compose.ui.text.TextRange)`. | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#subSequence(kotlin.Int,kotlin.Int)(startIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, endIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Return a substring for the AnnotatedString and include the styles in the range of `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#subSequence(kotlin.Int,kotlin.Int)` (inclusive) and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#subSequence(kotlin.Int,kotlin.Int)` (exclusive). | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#length()` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle>>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#paragraphStyles()` All `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle` that have been applied to a range of this String | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle>>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#spanStyles()` All `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle` that have been applied to a range of this String | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#text()` | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.[capitalize](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).capitalize(androidx.compose.ui.text.intl.LocaleList))(localeList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList)` **This function is deprecated.** This method allows passing an empty locale list, which will pull a locale in a way that can't be backed by snapshot state. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).capitalize(androidx.compose.ui.text.intl.Locale)(locale: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/Locale)` Create capitalized `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.[decapitalize](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).decapitalize(androidx.compose.ui.text.intl.LocaleList))(localeList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList)` **This function is deprecated.** This method allows passing an empty locale list, which will pull a locale in a way that can't be backed by snapshot state. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).decapitalize(androidx.compose.ui.text.intl.Locale)(locale: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/Locale)` Create decapitalized `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.[toLowerCase](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).toLowerCase(androidx.compose.ui.text.intl.LocaleList))(localeList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList)` **This function is deprecated.** This method allows passing an empty locale list, which will pull a locale in a way that can't be backed by snapshot state. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).toLowerCase(androidx.compose.ui.text.intl.Locale)(locale: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/Locale)` Create lower case transformed `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.[toUpperCase](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).toUpperCase(androidx.compose.ui.text.intl.LocaleList))(localeList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList)` **This function is deprecated.** This method allows passing an empty locale list, which will pull a locale in a way that can't be backed by snapshot state. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).toUpperCase(androidx.compose.ui.text.intl.Locale)(locale: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/Locale)` Create upper case transformed `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | Cmn |

## Public companion properties

### Saver

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0)

```
val Saver: Saver<AnnotatedString, *>
```

The default `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#Saver()` implementation for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`.

Note this Saver doesn't preserve the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkInteractionListener` of the links. You should handle this case manually if required (check https://issuetracker.google.com/issues/332901550 for an example).

## Public constructors

### AnnotatedString

Cmn

```
AnnotatedString(
    text: String,
    annotations: List<AnnotatedString.Range<AnnotatedString.Annotation>> = listOf()
)
```

Creates an `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` with annotations.

```kotlin
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.AnnotatedString.Range
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.ParagraphStyle
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.style.TextAlign

AnnotatedString(
    text = "Jetpack Compose",
    // mark all text as a link, separate it into two paragraphs and make "Compose" italic
    annotations =
        listOf(
            AnnotatedString.Range(
                LinkAnnotation.Url("https://developer.android.com/jetpack/compose"),
                0,
                15,
            ),
            AnnotatedString.Range(ParagraphStyle(textAlign = TextAlign.Center), 0, 8),
            AnnotatedString.Range(SpanStyle(fontStyle = FontStyle.Italic), 8, 15),
        ),
)
```

| Parameters |
|---|---|
| `text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | text to display |
| `annotations: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Annotation>> = listOf()` | annotations to apply to text. Overlapping `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle`s merge (see `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` merging rules). `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle` ranges must follow paragraph arrangement rules (see `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` class documentation). |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(kotlin.String,kotlin.collections.List)` contains invalid overlapping paragraph ranges |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Annotation` |   |

### AnnotatedString

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
AnnotatedString(
    text: String,
    spanStyles: List<AnnotatedString.Range<SpanStyle>> = listOf(),
    paragraphStyles: List<AnnotatedString.Range<ParagraphStyle>> = listOf()
)
```

Creates an `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` with styles.

Use alternative constructor for other `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Annotation` types.

```kotlin
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.AnnotatedString.Range
import androidx.compose.ui.text.ParagraphStyle
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextIndent
import androidx.compose.ui.unit.sp

AnnotatedString(
    text = "Hello World",
    // make "Hello" italic.
    spanStyles = listOf(AnnotatedString.Range(SpanStyle(fontStyle = FontStyle.Italic), 0, 5)),
    // create two paragraphs with different alignment and indent settings.
    paragraphStyles =
        listOf(
            AnnotatedString.Range(ParagraphStyle(textAlign = TextAlign.Center), 0, 6),
            AnnotatedString.Range(ParagraphStyle(textIndent = TextIndent(5.sp)), 6, 11),
        ),
)
```

| Parameters |
|---|---|
| `text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | text to display |
| `spanStyles: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle>> = listOf()` | styles to apply to text. Overlapping `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle`s merge (see `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` merging rules). |
| `paragraphStyles: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle>> = listOf()` | paragraph styles to apply to ranges of text. Ranges must follow the paragraph arrangement rules (see `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` class documentation). |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(kotlin.String,kotlin.collections.List,kotlin.collections.List)` contains invalid overlapping ranges |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle` |   |

## Public functions

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### flatMapAnnotations

Cmn

```
fun flatMapAnnotations(
    transform: (AnnotatedString.Range<AnnotatedString.Annotation>) -> List<AnnotatedString.Range<AnnotatedString.Annotation>>
): AnnotatedString
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` where a list of annotations contains all elements yielded from results `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#flatMapAnnotations(kotlin.Function1)` function being invoked on each element of original annotations list.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#mapAnnotations(kotlin.Function1)` |   |

### get

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
open operator fun get(index: Int): Char
```

### getLinkAnnotations

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0)

```
fun getLinkAnnotations(start: Int, end: Int): List<AnnotatedString.Range<LinkAnnotation>>
```

Query all of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation`s attached on this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`.

| Parameters |
|---|---|
| `start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the start of the query range, inclusive. |
| `end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the end of the query range, exclusive. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation>>` | a list of annotations stored in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range`. Notice that All annotations that intersect with the range \[start, end) will be returned. When `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getLinkAnnotations(kotlin.Int,kotlin.Int)` is bigger than `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getLinkAnnotations(kotlin.Int,kotlin.Int)`, an empty list will be returned. |

### getStringAnnotations

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun getStringAnnotations(start: Int, end: Int): List<AnnotatedString.Range<String>>
```

Query all of the string annotations attached on this AnnotatedString.

| Parameters |
|---|---|
| `start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the start of the query range, inclusive. |
| `end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the end of the query range, exclusive. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html>>` | a list of annotations stored in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range`. Notice that All annotations that intersect with the range \[start, end) will be returned. When `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getStringAnnotations(kotlin.Int,kotlin.Int)` is bigger than `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getStringAnnotations(kotlin.Int,kotlin.Int)`, an empty list will be returned. |

### getStringAnnotations

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun getStringAnnotations(tag: String, start: Int, end: Int): List<AnnotatedString.Range<String>>
```

Query the string annotations attached on this AnnotatedString. Annotations are metadata attached on the AnnotatedString, for example, a URL is a string metadata attached on the a certain range. Annotations are also store with `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range` like the styles.

| Parameters |
|---|---|
| `tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the tag of the annotations that is being queried. It's used to distinguish the annotations for different purposes. |
| `start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the start of the query range, inclusive. |
| `end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the end of the query range, exclusive. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html>>` | a list of annotations stored in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range`. Notice that All annotations that intersect with the range \[start, end) will be returned. When `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getStringAnnotations(kotlin.String,kotlin.Int,kotlin.Int)` is bigger than `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getStringAnnotations(kotlin.String,kotlin.Int,kotlin.Int)`, an empty list will be returned. |

### getTtsAnnotations

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun getTtsAnnotations(start: Int, end: Int): List<AnnotatedString.Range<TtsAnnotation>>
```

Query all of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TtsAnnotation`s attached on this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`.

| Parameters |
|---|---|
| `start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the start of the query range, inclusive. |
| `end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the end of the query range, exclusive. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TtsAnnotation>>` | a list of annotations stored in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range`. Notice that All annotations that intersect with the range \[start, end) will be returned. When `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getTtsAnnotations(kotlin.Int,kotlin.Int)` is bigger than `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getTtsAnnotations(kotlin.Int,kotlin.Int)`, an empty list will be returned. |

### getUrlAnnotations

Cmn Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.3.0) Deprecated in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0)

```
@ExperimentalTextApi
fun [getUrlAnnotations](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getUrlAnnotations(kotlin.Int,kotlin.Int))(start: Int, end: Int): List<AnnotatedString.Range<UrlAnnotation>>
```

> [!CAUTION]
> **This function is deprecated.**   
> Use LinkAnnotation API instead, use this instead:
>
> ```kotlin
> getLinkAnnotations(start, end)
> ```

Query all of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/UrlAnnotation`s attached on this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`.

| Parameters |
|---|---|
| `start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the start of the query range, inclusive. |
| `end: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the end of the query range, exclusive. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/UrlAnnotation>>` | a list of annotations stored in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range`. Notice that All annotations that intersect with the range \[start, end) will be returned. When `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getUrlAnnotations(kotlin.Int,kotlin.Int)` is bigger than `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getUrlAnnotations(kotlin.Int,kotlin.Int)`, an empty list will be returned. |

### hasEqualAnnotations

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0)

```
fun hasEqualAnnotations(other: AnnotatedString): Boolean
```

Compare the annotations between this and another AnnotatedString.

This may be used for fast partial equality checks.

Note that this checks all annotations including `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#spanStyles()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#paragraphStyles()`, but `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#equals(kotlin.Any)` still may be false if `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#text()` is different.

| Parameters |
|---|---|
| `other: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | to compare annotations with |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if and only if this compares equal on annotations with other |

### hasLinkAnnotations

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0)

```
fun hasLinkAnnotations(start: Int, end: Int): Boolean
```

Returns true if `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getLinkAnnotations(kotlin.Int,kotlin.Int)` with the same parameters would return a non-empty list

### hasStringAnnotations

Cmn Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.4.0)

```
fun hasStringAnnotations(tag: String, start: Int, end: Int): Boolean
```

Returns true if `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#getStringAnnotations(kotlin.String,kotlin.Int,kotlin.Int)` with the same parameters would return a non-empty list

### hashCode

Cmn

```
open fun hashCode(): Int
```

### mapAnnotations

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun mapAnnotations(
    transform: (AnnotatedString.Range<AnnotatedString.Annotation>) -> AnnotatedString.Range<AnnotatedString.Annotation>
): AnnotatedString
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` where a list of annotations contains the results of applying the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#mapAnnotations(kotlin.Function1)` function to each element in the original annotations list.

```kotlin
import androidx.compose.foundation.text.BasicText
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString.Range
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLinkStyles

// An example of applying color to the links in the given text where the `linkColor` would
// usually come from the theme in your app
val linkStyles = TextLinkStyles(style = SpanStyle(color = linkColor))
BasicText(
    text.mapAnnotations {
        when (it.item) {
            is LinkAnnotation.Url ->
                (it as Range<LinkAnnotation.Url>).copy(it.item.copy(styles = linkStyles))
            is LinkAnnotation.Clickable ->
                (it as Range<LinkAnnotation.Clickable>).copy(it.item.copy(styles = linkStyles))
            else -> it
        }
    }
)
```

### plus

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
operator fun plus(other: AnnotatedString): AnnotatedString
```

### subSequence

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun subSequence(range: TextRange): AnnotatedString
```

Return a substring for the AnnotatedString and include the styles in the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#subSequence(androidx.compose.ui.text.TextRange)`.

| Parameters |
|---|---|
| `range: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextRange` | the text range |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#subSequence(androidx.compose.ui.text.TextRange)` | (start: Int, end: Int) |

### subSequence

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
open fun subSequence(startIndex: Int, endIndex: Int): AnnotatedString
```

Return a substring for the AnnotatedString and include the styles in the range of `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#subSequence(kotlin.Int,kotlin.Int)` (inclusive) and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#subSequence(kotlin.Int,kotlin.Int)` (exclusive).

| Parameters |
|---|---|
| `startIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the inclusive start offset of the range |
| `endIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the exclusive end offset of the range |

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### length

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
open val length: Int
```

### paragraphStyles

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val paragraphStyles: List<AnnotatedString.Range<ParagraphStyle>>
```

All `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/ParagraphStyle` that have been applied to a range of this String

### spanStyles

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val spanStyles: List<AnnotatedString.Range<SpanStyle>>
```

All `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle` that have been applied to a range of this String

### text

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val text: String
```

## Extension functions

### AnnotatedString.capitalize

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/AnnotatedString.kt+function:capitalize)

```
fun AnnotatedString.[capitalize](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).capitalize(androidx.compose.ui.text.intl.LocaleList))(localeList: LocaleList = LocaleList.current): AnnotatedString
```

> [!CAUTION]
> **This function is deprecated.**   
> This method allows passing an empty locale list, which will pull a locale in a way that can't be backed by snapshot state. Call capitalize with an explicit locale instead. If you have a non-empty locale list, the correct thing to do is use the first locale in the list.

Create capitalized `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`

The capitalization sometimes maps different number of characters. This function adjusts the text style and paragraph style ranges to transformed offset.

Note, if the style's offset is middle of the capitalization context, this function won't transform the character, e.g. style starts from between base alphabet character and accent character.

| Parameters |
|---|---|
| `localeList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList = LocaleList.current` | A locale list used for capitalize mapping. Only the first locale is effective. If empty locale list is passed, use the current locale instead. Note that, this locale is currently ignored since underlying Kotlin method is experimental. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | A capitalized string. |

### AnnotatedString.capitalize

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/AnnotatedString.kt+function:capitalize)

```
fun AnnotatedString.capitalize(locale: Locale): AnnotatedString
```

Create capitalized `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`

The capitalization sometimes maps different number of characters. This function adjusts the text style and paragraph style ranges to transformed offset.

Note, if the style's offset is middle of the capitalization context, this function won't transform the character, e.g. style starts from between base alphabet character and accent character.

| Parameters |
|---|---|
| `locale: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/Locale` | The locale used for capitalize mapping. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | A capitalized `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`. |

### AnnotatedString.decapitalize

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/AnnotatedString.kt+function:decapitalize)

```
fun AnnotatedString.[decapitalize](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).decapitalize(androidx.compose.ui.text.intl.LocaleList))(localeList: LocaleList = LocaleList.current): AnnotatedString
```

> [!CAUTION]
> **This function is deprecated.**   
> This method allows passing an empty locale list, which will pull a locale in a way that can't be backed by snapshot state. Call decapitalize with an explicit locale instead. If you have a non-empty locale list, the correct thing to do is use the first locale in the list.

Create decapitalized `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`

The decapitalization sometimes maps different number of characters. This function adjusts the text style and paragraph style ranges to transformed offset.

Note, if the style's offset is middle of the decapitalization context, this function won't transform the character, e.g. style starts from between base alphabet character and accent character.

| Parameters |
|---|---|
| `localeList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList = LocaleList.current` | A locale list used for decapitalize mapping. Only the first locale is effective. If empty locale list is passed, use the current locale instead. Note that, this locale is currently ignored since underlying Kotlin method is experimental. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | A decapitalized `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`. |

### AnnotatedString.decapitalize

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/AnnotatedString.kt+function:decapitalize)

```
fun AnnotatedString.decapitalize(locale: Locale): AnnotatedString
```

Create decapitalized `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`

The decapitalization sometimes maps different number of characters. This function adjusts the text style and paragraph style ranges to transformed offset.

Note, if the style's offset is middle of the decapitalization context, this function won't transform the character, e.g. style starts from between base alphabet character and accent character.

| Parameters |
|---|---|
| `locale: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/Locale` | The locale used for decapitalize mapping. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | A decapitalized `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`. |

### AnnotatedString.toLowerCase

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/AnnotatedString.kt+function:toLowerCase)

```
fun AnnotatedString.[toLowerCase](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).toLowerCase(androidx.compose.ui.text.intl.LocaleList))(localeList: LocaleList = LocaleList.current): AnnotatedString
```

> [!CAUTION]
> **This function is deprecated.**   
> This method allows passing an empty locale list, which will pull a locale in a way that can't be backed by snapshot state. Call toLowerCase with an explicit locale instead. If you have a non-empty locale list, the correct thing to do is use the first locale in the list.

Create lower case transformed `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`

The lowercase sometimes maps different number of characters. This function adjusts the text style and paragraph style ranges to transformed offset.

Note, if the style's offset is middle of the lowercase mapping context, this function won't transform the character, e.g. style starts from between base alphabet character and accent character.

| Parameters |
|---|---|
| `localeList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList = LocaleList.current` | A locale list used for lower case mapping. Only the first locale is effective. If empty locale list is passed, use the current locale instead. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | A lowercase transformed string. |

### AnnotatedString.toLowerCase

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/AnnotatedString.kt+function:toLowerCase)

```
fun AnnotatedString.toLowerCase(locale: Locale): AnnotatedString
```

Create lower case transformed `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`

The lowercase sometimes maps different number of characters. This function adjusts the text style and paragraph style ranges to transformed offset.

Note, if the style's offset is middle of the lowercase mapping context, this function won't transform the character, e.g. style starts from between base alphabet character and accent character.

| Parameters |
|---|---|
| `locale: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/Locale` | The locale used for lower case mapping. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | A lowercase transformed `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`. |

### AnnotatedString.toUpperCase

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/AnnotatedString.kt+function:toUpperCase)

```
fun AnnotatedString.[toUpperCase](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString#(androidx.compose.ui.text.AnnotatedString).toUpperCase(androidx.compose.ui.text.intl.LocaleList))(localeList: LocaleList = LocaleList.current): AnnotatedString
```

> [!CAUTION]
> **This function is deprecated.**   
> This method allows passing an empty locale list, which will pull a locale in a way that can't be backed by snapshot state. Call toUpperCase with an explicit locale instead. If you have a non-empty locale list, the correct thing to do is use the first locale in the list.

Create upper case transformed `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`

The uppercase sometimes maps different number of characters. This function adjusts the text style and paragraph style ranges to transformed offset.

Note, if the style's offset is middle of the uppercase mapping context, this function won't transform the character, e.g. style starts from between base alphabet character and accent character.

| Parameters |
|---|---|
| `localeList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList = LocaleList.current` | A locale list used for upper case mapping. Only the first locale is effective. If empty locale list is passed, use the current locale instead. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | An uppercase transformed `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`. |

### AnnotatedString.toUpperCase

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/AnnotatedString.kt+function:toUpperCase)

```
fun AnnotatedString.toUpperCase(locale: Locale): AnnotatedString
```

Create upper case transformed `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`

The uppercase sometimes maps different number of characters. This function adjusts the text style and paragraph style ranges to transformed offset.

Note, if the style's offset is middle of the uppercase mapping context, this function won't transform the character, e.g. style starts from between base alphabet character and accent character.

| Parameters |
|---|---|
| `locale: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/Locale` | The locale used for upper case mapping. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | An uppercase transformed `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString`. |