Nodes/ComfyUI-RyuuNoodles/Clean String Adv. 🐲
ComfyUI Node

Clean String Adv. 🐲

Cleans up and formats the given text with a set of optional filters: - Strip whitespace (off/left/right/both) from the input string - Remove or add trailing comma from the input string - Collapse multiple spaces in the input string - Convert to lowercase/uppercase and more - Control newline handling (off/remove empty/collapse lines) Useful for normalizing input strings for consistent processing.

By DraconicDragonΒ·Created about a year agoΒ·Updated about a month agoΒ· 11
Clean String Adv. 🐲
    • text
    β—„input_textβ–Ί
    β—„stripbothβ–Ί
    β—„trailing_commasremoveβ–Ί
    β—„newlinesoffβ–Ί
    β—„collapsespaces + commasβ–Ί
    β—„remove_duplicate_tagsfalseβ–Ί
    β—„caseoffβ–Ί
    CategoryRyuuNoodles 🐲/Text

    Inputs (7)

    NameTypeDefaultDescription
    input_textSTRINGText input to be cleaned.
    stripCOMBObothControl which side(s) of whitespace to strip from the input string.
    trailing_commasCOMBOremoveRemove or add a comma at the end of the input string. Will not add a comma if one already exists, but will add a space if 'add + space' is chosen and a comma exists but no space.
    newlinesCOMBOoffControl how newlines are handled off = keep all lines remove empty = drop blank lines collapse lines = join all lines into one
    collapseCOMBOspaces + commasCollapse multiple consecutive spaces into one, or collapse both spaces and commas into a single occurrence depending on the selected option. Example: 'apple, banana, apple, orange.' β†’ 'apple, banana, orange.'
    remove_duplicate_tagsBOOLEANfalseRemove duplicate tags/words separated by commas, handling spaces around commas and ensuring only unique entries remain. Example: 'apple, banana, apple, orange' β†’ 'apple, banana, orange'
    caseCOMBOoffChange the case of the string. Examples with input 'apple, banana, orange.': off = no change ('apple, banana, orange. juice') lowercase = all lowercase ('apple, banana, orange. juice') uppercase = ALL UPPERCASE ('APPLE, BANANA, ORANGE. JUICE') capitalize = Capitalize the start of every sentence (after punctuation or empty lines) and lowercase the rest ('Apple, banana. Orange. Juice') capitalize_1st_letter = Capitalize only the first letter of the input string ('Apple, banana. orange. juice') camelcase = likeThisExample ('appleBananaOrange.Juice') pascalcase = LikeThisExample ('AppleBananaOrange.Juice') snakecase = like_this_example, always lowercase ('apple_banana_orange._juice') kebabcase = like-this-example, always lowercase ('apple-banana-orange.-juice') titlecase = Every Word Capitalized ('Apple, Banana, Orange. Juice')

    Outputs (1)

    NameTypeDescription
    textSTRINGβ€”