ComfyUI > Nodes > ComfyUI_Lam > 文本分割转列表

ComfyUI Node: 文本分割转列表

Class Name

LongTextToList

Category
lam
Author
Lam Yan (Account age: 3065days)
Extension
ComfyUI_Lam
Latest Updated
2025-03-06
Github Stars
0.02K

How to Install ComfyUI_Lam

Install this extension via the ComfyUI Manager by searching for ComfyUI_Lam
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_Lam in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

文本分割转列表 Description

Transforms long text into a list of substrings using a specified delimiter for easier processing and analysis.

文本分割转列表:

The LongTextToList node is designed to transform a long string of text into a list of substrings based on a specified delimiter. This node is particularly useful when you need to process or analyze text data that is structured in a continuous format but logically divided into segments. By converting the text into a list, you can easily access and manipulate individual segments, making it easier to perform operations such as searching, sorting, or further processing. The node also allows you to retrieve a specific segment from the list by specifying its index, providing a convenient way to focus on particular parts of the text. This functionality is essential for tasks that involve text parsing, data extraction, or any scenario where text needs to be broken down into manageable pieces.

文本分割转列表 Input Parameters:

text

The text parameter is a multiline string input that represents the long text you wish to split into a list. This parameter is crucial as it contains the data that will be processed by the node. The default value is an empty string, and it supports multiline input, allowing you to input large blocks of text without restrictions.

i

The i parameter is an integer that specifies the index of the substring you want to retrieve from the resulting list. This parameter allows you to directly access a specific segment of the text after it has been split. The default value is 0, with a minimum of 0 and a maximum of 99999, ensuring flexibility in accessing any part of the list.

delimiter

The delimiter parameter is a string that defines the character or sequence of characters used to split the text into a list. This parameter is essential for determining how the text is divided into segments. It can be customized to suit the structure of your text, and it supports special characters like newline (\n) by using escape sequences.

文本分割转列表 Output Parameters:

下标i文本

The 下标i文本 output is a string that represents the specific segment of the text at the index specified by the i parameter. This output is useful for directly accessing and utilizing a particular part of the text without needing to manually parse the entire list.

数组

The 数组 output is a list of strings that contains all the segments of the text after it has been split by the delimiter. This output provides a comprehensive view of the text's structure, allowing you to perform various operations on each segment individually.

数组长度

The 数组长度 output is an integer that indicates the total number of segments in the list. This output is helpful for understanding the size of the list and can be used to validate the index specified by the i parameter or to iterate over the list.

文本分割转列表 Usage Tips:

  • Use a consistent delimiter that matches the structure of your text to ensure accurate splitting into segments.
  • If you need to access multiple segments, consider using a loop to iterate over the 数组 output instead of repeatedly specifying different indices.
  • When working with newline characters as delimiters, remember to use the escape sequence \\n to ensure proper interpretation.

文本分割转列表 Common Errors and Solutions:

IndexError: list index out of range

  • Explanation: This error occurs when the specified index i is greater than or equal to the length of the list.
  • Solution: Ensure that the i parameter is within the valid range by checking the 数组长度 output before accessing the 下标i文本.

ValueError: empty delimiter

  • Explanation: This error happens when the delimiter parameter is an empty string, which is not allowed.
  • Solution: Provide a valid delimiter that matches the structure of your text to enable proper splitting.

文本分割转列表 Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_Lam
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.