ComfyUI > Nodes > Comfyroll Studio > ⚙️ CR Set Value on String

ComfyUI Node: ⚙️ CR Set Value on String

Class Name

CR Set Value on String

Category
🧩 Comfyroll Studio/🛠️ Utils/🔀 Conditional
Author
Suzie1 (Account age: 2158days)
Extension
Comfyroll Studio
Latest Updated
2024-06-05
Github Stars
0.49K

How to Install Comfyroll Studio

Install this extension via the ComfyUI Manager by searching for Comfyroll Studio
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Comfyroll Studio 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

⚙️ CR Set Value on String Description

Conditional string replacement based on substring presence for dynamic text manipulation in AI art projects.

⚙️ CR Set Value on String:

The CR Set Value on String node is designed to conditionally replace a given string based on the presence of a specified substring. This node is particularly useful for scenarios where you need to dynamically alter text content depending on whether a certain condition is met. By leveraging this node, you can streamline text manipulation tasks, ensuring that your string outputs are tailored to specific conditions without the need for complex scripting. The primary function of this node is to check if a test_string is present within the input text. If the condition is true, the node outputs a predefined value_if_true; otherwise, it outputs a value_if_false. This functionality is essential for creating adaptive and responsive text-based workflows in your AI art projects.

⚙️ CR Set Value on String Input Parameters:

text

This parameter represents the input string that will be evaluated. It is a required field and must be provided for the node to function. The text parameter is the main string in which the node will search for the presence of the test_string. It does not support multiline input and defaults to an empty string.

test_string

This optional parameter specifies the substring that the node will search for within the text. If the test_string is found in the text, the node will output the value_if_true. If not, it will output the value_if_false. This parameter also does not support multiline input and defaults to an empty string.

value_if_true

This optional parameter defines the string that will be output if the test_string is found within the text. It allows you to specify what the output should be when the condition is met. This parameter does not support multiline input and defaults to an empty string.

value_if_false

This optional parameter defines the string that will be output if the test_string is not found within the text. It allows you to specify what the output should be when the condition is not met. This parameter does not support multiline input and defaults to an empty string.

⚙️ CR Set Value on String Output Parameters:

STRING

This output parameter provides the resulting string after the conditional check. If the test_string is found within the text, this output will be the value_if_true; otherwise, it will be the value_if_false. This output is crucial for dynamically generating text based on specific conditions.

BOOLEAN

This output parameter indicates whether the test_string was found within the text. It returns True if the test_string is present and False if it is not. This boolean output can be used to trigger other conditional nodes or logic in your workflow.

show_help

This output parameter provides a URL link to the documentation or help page for the node. It is useful for users who need additional information or guidance on how to use the node effectively.

⚙️ CR Set Value on String Usage Tips:

  • Use the test_string parameter to define specific keywords or phrases that you want to check for within the text. This can help in creating dynamic and context-sensitive text outputs.
  • Leverage the value_if_true and value_if_false parameters to customize the output based on the presence or absence of the test_string. This can be particularly useful for generating different responses or messages in your AI art projects.

⚙️ CR Set Value on String Common Errors and Solutions:

Missing required input: text

  • Explanation: The text parameter is required and must be provided for the node to function.
  • Solution: Ensure that you provide a valid string for the text parameter.

Invalid type for test_string

  • Explanation: The test_string parameter must be a string.
  • Solution: Verify that the test_string parameter is correctly set to a string value.

Invalid type for value_if_true

  • Explanation: The value_if_true parameter must be a string.
  • Solution: Verify that the value_if_true parameter is correctly set to a string value.

Invalid type for value_if_false

  • Explanation: The value_if_false parameter must be a string.
  • Solution: Verify that the value_if_false parameter is correctly set to a string value.

⚙️ CR Set Value on String Related Nodes

Go back to the extension to check out more related nodes.
Comfyroll Studio
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.