> ## Documentation Index
> Fetch the complete documentation index at: https://kk-83bff226.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# countOccurrences

> Counts the occurrences of a target character in a given string.

## Signature

```typescript path=null start=null theme={null}
countOccurrences(str: string, targetChar: string): number
```

## Parameters

* **str**: `string` - The input string.
* **targetChar**: `string` - The character to count occurrences of.

## Returns

`number` - The number of occurrences of `targetChar` in `str`.

## Source

Defined in [string.ts:123](https://github.com/koji/ichigyou/blob/main/src/string.ts#L123)
