ComfyUI > Nodes > Basic data handling > string compare

ComfyUI Node: string compare

Class Name

Basic data handling: StringComparison

Category
Basic/comparison
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

string compare Description

The `StringComparison` node compares two strings using various operators, supporting case sensitivity.

string compare:

The StringComparison node is designed to facilitate the comparison of two strings using a variety of operators, providing a flexible tool for determining the relationship between string values. This node is particularly useful in scenarios where you need to evaluate whether two strings are equal, not equal, or if one string is greater or less than the other. It supports both case-sensitive and case-insensitive comparisons, allowing you to tailor the comparison to your specific needs. By leveraging this node, you can efficiently handle string comparisons in your workflows, making it an essential component for tasks that involve conditional logic based on string data.

string compare Input Parameters:

string1

This parameter represents the first string to be compared. It is a required input and serves as one of the two primary operands in the comparison operation. The default value is an empty string, but you can provide any string value to suit your comparison needs.

string2

This parameter represents the second string to be compared against the first. Like string1, it is a required input and acts as the second operand in the comparison. The default value is an empty string, allowing you to input any string value necessary for your comparison task.

operator

The operator parameter specifies the type of comparison to be performed between string1 and string2. Available options include ==, !=, >, <, >=, and <=. The default operator is ==, which checks for equality. This parameter is crucial as it determines the nature of the comparison and the resulting boolean output.

case_sensitive

This boolean parameter dictates whether the comparison should be case-sensitive. If set to True, the comparison will consider the case of the characters in the strings, while setting it to False will ignore case differences. The default value is True, ensuring that comparisons are case-sensitive unless specified otherwise.

string compare Output Parameters:

result

The result parameter is a boolean output that indicates the outcome of the string comparison. It returns True if the comparison condition specified by the operator is met, and False otherwise. This output is essential for determining the relationship between the two input strings based on the selected comparison criteria.

string compare Usage Tips:

  • Use the case_sensitive parameter to control whether the comparison should consider character case, which is particularly useful when dealing with user input or data where case consistency is not guaranteed.
  • Experiment with different operator values to perform various types of comparisons, such as checking for equality, inequality, or ordering, to suit your specific logic requirements.

string compare Common Errors and Solutions:

Unknown operator: <operator>

  • Explanation: This error occurs when an invalid or unsupported operator is provided in the operator parameter.
  • Solution: Ensure that the operator parameter is set to one of the supported values: ==, !=, >, <, >=, or <=. Double-check the input to avoid typos or unsupported operators.

string compare 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.

string compare