ComfyUI > Nodes > ComfyUI 1hewNodes > String Filter

ComfyUI Node: String Filter

Class Name

1hew_StringFilter

Category
1hewNodes/text
Author
1hew (Account age: 1113days)
Extension
ComfyUI 1hewNodes
Latest Updated
2026-04-17
Github Stars
0.03K

How to Install ComfyUI 1hewNodes

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

The 1hew_StringFilter node refines text by removing comments and empty lines for clarity and conciseness.

String Filter:

The 1hew_StringFilter node is designed to process and refine text by filtering out unwanted elements such as comments and empty lines. This node is particularly useful for cleaning up text data, making it more readable and manageable. By allowing you to specify whether to remove comments or empty lines, it provides a flexible approach to text processing. This can be especially beneficial when dealing with large blocks of text or code, where clarity and conciseness are essential. The node's primary goal is to streamline text content, ensuring that only the relevant information is retained, which can be crucial for tasks that require clean and structured text input.

String Filter Input Parameters:

text

This parameter accepts the main text input that you wish to process. It supports multiline text, allowing you to input large blocks of text or code. The text is processed to remove specified elements based on other parameters. There is no explicit minimum or maximum value, but the default is an empty string.

filter_empty_line

This boolean parameter determines whether empty lines should be removed from the text. When set to True, any line that is empty or contains only whitespace will be excluded from the output. The default value is False, meaning empty lines will be retained unless specified otherwise.

filter_comment

This boolean parameter controls the removal of comments from the text. When enabled (True), lines starting with a # or enclosed in multiline comment quotes (""" or ''') are filtered out. This is particularly useful for cleaning up code or text files where comments are not needed. The default setting is False, allowing comments to remain unless specified otherwise.

input

This parameter allows you to insert additional text into the main text input by replacing occurrences of {input} with the specified string. It provides a way to dynamically modify the text content based on external input. The default value is an empty string.

String Filter Output Parameters:

string

The output parameter string provides the processed text after applying the specified filters. It returns a cleaned version of the input text, with comments and/or empty lines removed based on the input parameters. This output is crucial for ensuring that the text is concise and free of unnecessary elements, making it suitable for further processing or analysis.

String Filter Usage Tips:

  • To effectively clean up code or text files, enable filter_comment to remove all comments, which can help in focusing on the main content.
  • Use filter_empty_line to eliminate unnecessary whitespace, which can improve the readability of the text, especially in large documents.
  • Utilize the input parameter to dynamically insert context-specific information into your text, which can be useful for templating or generating customized outputs.

String Filter Common Errors and Solutions:

Empty Output

  • Explanation: If the output is empty, it might be due to all lines being filtered out based on the selected parameters.
  • Solution: Review the filter_comment and filter_empty_line settings to ensure they align with your intended output. Adjust these parameters to retain necessary lines.

Unexpected Characters in Output

  • Explanation: This may occur if the {input} placeholder is not correctly replaced due to an empty or incorrect input parameter.
  • Solution: Ensure that the input parameter is correctly set with the desired replacement text. Double-check for any typos or missing values.

String Filter Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI 1hewNodes
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 Filter