ComfyUI Node: length

Class Name

Basic data handling: StringLength

Category
Basic/STRING
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling 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

length Description

The `StringLength` node calculates the character count of a string, aiding in text processing tasks.

length:

The StringLength node is designed to determine the number of characters in a given string, providing a straightforward way to assess the length of text data. This node is particularly useful when you need to evaluate the size of a string for tasks such as text processing, validation, or formatting. By leveraging the functionality similar to Python's built-in len() function, it offers a reliable and efficient method to obtain the character count of any input string. This capability is essential for managing and manipulating text data, ensuring that you can handle strings of varying lengths with ease.

length Input Parameters:

string

The string parameter is the text input for which you want to determine the length. It accepts any string value, including empty strings, and calculates the number of characters present. This parameter is crucial as it directly influences the node's output, which is the length of the string. There are no specific minimum or maximum values for this parameter, as it can handle strings of any length, including multiline text.

length Output Parameters:

length

The length output parameter provides the total number of characters in the input string. This integer value represents the string's size, making it a vital piece of information for tasks that require knowledge of text length, such as ensuring input meets certain criteria or preparing data for further processing. The output is straightforward and directly corresponds to the input string's character count.

length Usage Tips:

  • Use the StringLength node to quickly validate if a string meets specific length requirements, such as minimum or maximum character limits.
  • Combine this node with other string manipulation nodes to dynamically adjust or format text based on its length, enhancing your text processing workflows.

length Common Errors and Solutions:

Empty String Input

  • Explanation: When an empty string is provided as input, the node will return a length of zero.
  • Solution: Ensure that the input string is not empty if a non-zero length is expected. Verify the source of the string to confirm it contains the desired content.

Non-String Input

  • Explanation: If a non-string input is mistakenly provided, the node may not function as intended.
  • Solution: Double-check that the input is a valid string. Convert any non-string data to a string format before passing it to the node.

length Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
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 Models, enabling artists to harness the latest AI tools to create incredible art.

length