> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrics-man.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Linecount

# \$lineCount

The `$lineCount` operator counts the number of lines in a string.

## Input

* A single string value

## Output

* The number of lines in the input string (counting newline characters)

## Examples

### Count Lines in Multi-line String

```json theme={null}
{
  "$lineCount": [
    "Line 1\nLine 2\nLine 3"
  ]
}
```

Result: `3`

### Count Lines in Single Line

```json theme={null}
{
  "$lineCount": [
    "Single line"
  ]
}
```

Result: `1`

### Count Lines in Empty String

```json theme={null}
{
  "$lineCount": [
    ""
  ]
}
```

Result: `0`

### Field Value

```json theme={null}
{
  "$lineCount": [
    {
      "$input": "content"
    }
  ]
}
```

Result: The number of lines in the content field
