--- title: "split text(max length)" slug: "string-split-text-into-list" updated: 2026-08-17T08:15:04Z published: 2026-08-17T08:15:04Z canonical: "docs.lobstersoftware.com/string-split-text-into-list" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # split text(max length) This function splits the text **a** into substrings. From the left, the longest possible (maximum length **b**) substring that contains a blank (or the alternative separator in parameter **d**) as the last character is searched for. If such a substring cannot be formed, a substring of the maximum length **b** is formed from the left. The created substring is added to list **c**. The procedure is repeated for the remaining text until it is empty. The return value of the function is the number of substrings added to the list. ## Parameters | Parameter | Description | | --- | --- | | a | Text to be split. | | b | Maximum length (values < 0 are replaced with 50). | | c | Name of the list for the substrings. **NOTE:** If this list does not yet exist, it is created automatically. | | d | (optional) Splitting char. Default: space | ## Examples | Parameter a | Parameter b | Parameter c | Parameter d | Result | | --- | --- | --- | --- | --- | | This message is used for testing! | 10 | list_text_split | | *5* (List *list_text_split* with values {*This* ,*message* ,*is* *used* ,*for* ,*testing!*}) | | ThisMessageIsUsedForTesting! | 20 | list_text_split | | *2* (List *list_text_split* with values {*ThisMessageIsUsedFor*,*Testing!*}) | | This_message_is_used_for_testing! | 10 | list_text_split | _ | *5* (List *list_text_split* with values {*This_*,*message_*,*is_used_*,*for_*,*testing!*}) |