# String Contains Count

> Count the number of times a substring appears in a string.

- ID: `string_contains_count`
- Type: Block
- Category: [Strings](https://inventor.bot/docs/reference/blocks/strings.md)

- Value block: it can be used directly inside expressions, e.g. `"Result: " + string_contains_count(Args{...})`.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `text` | yes | String to search. | e.g. `"hello world"` |
| `substring` | yes | Substring to count. | e.g. `"l"` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `count` | Number of occurrences. | e.g. `"3"` |

**Example**

```go
stringContainsCount := string_contains_count(Args{text: "hello world", substring: "l"})
send_text_message(Args{
	channel_id:      trigger.channel_id,
	message_content: "Count: " + stringContainsCount,
})
```