Contar apariciones
count-occurrencesCuenta apariciones de una subcadena y devuelve sus posiciones. Cuándo: hay que transformar, comparar o medir un texto con exactitud y no por aproximación. No para: contar la frecuencia de palabras en un texto (word-frequency). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.
EN: Counts non-overlapping (or overlapping) occurrences of a substring, optionally case-insensitive, and returns their indices (first 1,000). When: text has to be transformed, compared or measured exactly instead of approximated. Not for: counting word frequencies in text (word-frequency). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Input text (string; required). | |
| substring | Yes | Substring (string; required; at least 1 chars; up to 1000 chars). | |
| overlapping | No | Count overlapping matches (boolean; optional; default false). | |
| case_sensitive | No | Case sensitive (boolean; optional; default true). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | ||
| indices | No |