String length / word count
The String Length / Word Count robot counts the number of characters and the number of words in a given string in Bitrix24 (Alaio) business processes and robots. Characters are counted with Unicode awareness (mb_strlen) and words by splitting on whitespace. It returns two integers: Character count and Word count for checks and branching of the process.
The robot determines the length of a string in characters and the number of words in it. The input is a source string; the output is an integer Character count (counted in UTF-8, multibyte characters count as one) and an integer Word count (the text is trimmed at the edges and split on whitespace). When to use it: verify that an SMS or comment text fits within a limit before sending; reject too-short or empty values via a following condition; estimate the size of a description or title before saving it to a CRM field. For an empty string both values are zero. Use the resulting numbers in the condition of the next step of the business process.
What input parameters does the robot accept?
| Parameter | Type | Required? | Default |
|---|---|---|---|
| Source string | string | yes |
What does the robot return?
| Parameter | Type |
|---|---|
| Character count | int |
| Word count | int |
Scenario: checking SMS text length before sending
- The robot receives the message text from a deal field
- The robot counts the number of characters in the string
- If Character count is greater than 70, a condition routes the process down the split-into-parts branch, otherwise the SMS goes out as a single message