> For the complete documentation index, see [llms.txt](https://chaoses-ib.gitbook.io/directory-opus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/evaluator/count.md).

# Count

\<evalcmd> Count && int && Number of path components. && path && path && Any path. \</evalcmd>

Returns the number of components in the path.

//<Example://>

```
p: path = "C:\Windows\System32";
Output( Count(p) );
--> 3
```

*See also:*\
[isparent](/directory-opus/manual/reference/evaluator/isparent.md)\
[parent](/directory-opus/manual/reference/evaluator/parent.md)

***

\<evalcmd> Count && int && Number of substring matches. && string && str && String to search. && substring && str && Sub-string to search for. && \[flags] && str && Flags. \</evalcmd>

Returns the number of times *substring* is found in *string*.

The optional flag **c** makes the search case-sensitive.

//<Example://>

```
str = "Hello world";
Output( Count(str, "l") );
--> 3
```

*See also:*\
[instr](/directory-opus/manual/reference/evaluator/instr.md)
