Skip to main content

$wordCount

The $wordCount operator counts the number of words in a string.

Input

  • A single string value

Output

  • The number of words in the input string

Examples

Count Words in Sentence

{
  "$wordCount": [
    "Hello world this is a test"
  ]
}
Result: 6

Count Words in Single Word

{
  "$wordCount": [
    "Hello"
  ]
}
Result: 1

Count Words in Empty String

{
  "$wordCount": [
    ""
  ]
}
Result: 0

Field Value

{
  "$wordCount": [
    {
      "$input": "text"
    }
  ]
}
Result: The number of words in the text field