ComfyUI Node: find

Class Name

Basic data handling: StringFind

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

find Description

StringFind locates the first occurrence of a substring in a string, returning its index or -1 if absent.

find:

The StringFind node is designed to help you locate the first occurrence of a specific substring within a given string. This node is particularly useful when you need to determine the position of a substring, as it returns the lowest index where the substring is found. If the substring is not present, it returns -1, indicating its absence. This functionality is essential for tasks that require precise string manipulation or analysis, such as parsing text data or extracting specific information from larger text bodies. The node also offers optional parameters to limit the search to a specific portion of the string, providing flexibility and control over the search operation.

find Input Parameters:

string

This parameter represents the main text in which you want to search for a substring. It is the primary input for the node and determines the context in which the search will be conducted. The default value is an empty string, meaning if no input is provided, the node will search within an empty context, which will always result in -1 unless the substring is also empty.

substring

The substring parameter specifies the sequence of characters you are looking to find within the main string. It is crucial for defining what you are searching for. Like the string parameter, its default value is an empty string. If both the string and substring are empty, the node will return 0, indicating that an empty substring is found at the start of an empty string.

start

This optional parameter allows you to specify the starting index from which the search should begin within the main string. It provides control over the search range, enabling you to skip over parts of the string that are not relevant to your search. The default value is 0, meaning the search will start from the beginning of the string. The minimum value is also 0, ensuring that the search does not start from a negative index.

end

Another optional parameter, the end parameter, defines the index at which the search should stop. This allows you to limit the search to a specific section of the string. If the end value is set to 0 or a negative number, the search will continue to the end of the string. This flexibility is useful for focusing the search on a particular segment of the string without altering the original string.

find Output Parameters:

int

The output of the StringFind node is an integer that represents the index of the first occurrence of the specified substring within the main string. If the substring is found, the output will be the lowest index where it appears. If the substring is not found, the output will be -1. This output is crucial for understanding the position of the substring within the string, which can be used for further string manipulation or analysis.

find Usage Tips:

  • Use the start and end parameters to narrow down your search to a specific section of the string, which can improve performance and accuracy when dealing with large texts.
  • If you are unsure whether the substring exists in the string, check the output for -1 to confirm its absence before proceeding with operations that depend on the substring's presence.

find Common Errors and Solutions:

Substring not found

  • Explanation: This occurs when the specified substring does not exist within the given string.
  • Solution: Verify that the substring is correctly specified and exists within the string. Consider adjusting the start and end parameters to ensure the search covers the intended portion of the string.

Invalid start or end index

  • Explanation: This error can occur if the start or end parameters are set to values outside the valid range of the string indices.
  • Solution: Ensure that the start and end parameters are within the bounds of the string's length. The start should be greater than or equal to 0, and the end should be greater than start if specified.

find 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.

find