---
title: "hasText"
description: "Returns whether the node's text contains the given [text].

This will also search in [SemanticsProperties.EditableText] and [SemanticsProperties.InputText].

Note that in merged semantics tree there can be a list of text items that got merged from the
child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to
use."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun hasText(
    text: String,
    substring: Boolean = false,
    ignoreCase: Boolean = false,
): SemanticsMatcher
```


Returns whether the node's text contains the given `text`.

This will also search in `SemanticsProperties.EditableText` and `SemanticsProperties.InputText`.

Note that in merged semantics tree there can be a list of text items that got merged from the
child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to
use.

#### Parameters

| | |
| --- | --- |
| text | Value to match as one of the items in the list of text values. |
| substring | Whether to use substring matching. |
| ignoreCase | Whether case should be ignored. |




