ComfyUI Node

String Functions (Soze)

Chain up to five text transforms in one node

By SozeInc·Created 2 years ago·Updated 5 days ago· 10
String Functions (Soze)
    • output
    • status
    input_string
    string_function_type1NONE
    string_function_type2NONE
    string_function_type3NONE
    string_function_type4NONE
    string_function_type5NONE

    Cleaning up a string for a filename or a tag list usually takes more than one operation - trim it, swap spaces for underscores, maybe uppercase it. Doing that with single-purpose string nodes means chaining three or four of them in a row. String Functions collapses that into one node with five sequential transform slots, each picked from a dropdown.

    How it works

    input_string runs through string_function_type1 first, and whatever comes out feeds into string_function_type2, and so on through slot 5. Any slot left at NONE (the default for all five) just passes the string through unchanged, so you only need to set as many stages as you actually use - leave the rest alone.

    The dropdown gives you a fair number of options: the usual case changes (uppercase, lowercase, title case), REVERSE, TRIM_SPACES, stripping digits or punctuation, and a set of find-and-replace-style swaps between spaces, underscores, and hyphens in both directions. There are a couple more beyond what's readily documented in the node's own picker - check the dropdown in your ComfyUI install for the full current list rather than assuming this covers every option.

    Because the stages run in sequence, order changes the result. Trimming spaces before you swap remaining spaces for underscores does something different than doing it the other way around - think of it the same way you'd think about function composition, not a set of independent flags.

    The inputs and outputs that matter

    • input_string (required, STRING) - the text going in.
    • string_function_type1string_function_type5 (optional, enum, default NONE) - the transform pipeline, applied in order.

    Outputs: output (the fully transformed string) and status.

    How to install it

    ComfyUI Manager → search "ComfyUI_Soze" → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SozeInc/ComfyUI_Soze.git
    pip install -r ComfyUI_Soze/requirements.txt
    

    then restart. Pure string handling, nothing beyond the base pack's dependencies.

    Common issues & troubleshooting

    If a transform doesn't seem to be applying, check two things in order: first, that you actually set that slot to something other than NONE (easy to think you configured slot 1 when you actually left slot 2 at the default); second, that an earlier stage in the chain hasn't already undone the condition the later stage was checking for - for example, running REMOVE_PUNCTUATION before a hyphen-to-space swap means there's no hyphen left by the time that stage runs.

    This is a natural pairing with Output Filename - normalize a raw title or tag string here (spaces to underscores, then uppercase, say) before feeding it into one of that node's File_Input slots, rather than hand-formatting names every time you build a save path.

    Categorystrings

    Inputs (6)

    NameTypeDefaultDescription
    input_stringSTRING
    string_function_type1optCOMBONONE14 options: NONE, UPPERCASE, LOWERCASE, TITLECASE, REVERSE, TRIM_SPACES, +8
    string_function_type2optCOMBONONE14 options: NONE, UPPERCASE, LOWERCASE, TITLECASE, REVERSE, TRIM_SPACES, +8
    string_function_type3optCOMBONONE14 options: NONE, UPPERCASE, LOWERCASE, TITLECASE, REVERSE, TRIM_SPACES, +8
    string_function_type4optCOMBONONE14 options: NONE, UPPERCASE, LOWERCASE, TITLECASE, REVERSE, TRIM_SPACES, +8
    string_function_type5optCOMBONONE14 options: NONE, UPPERCASE, LOWERCASE, TITLECASE, REVERSE, TRIM_SPACES, +8

    Outputs (2)

    NameTypeDescription
    outputSTRING
    statusSTRING