From d7c828461b650e7b9f40e23ad7b1222f138bd192 Mon Sep 17 00:00:00 2001 From: Kijai <40791699+kijai@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:56:55 +0200 Subject: [PATCH] Add suffix/prefix to stringify --- nodes.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nodes.py b/nodes.py index 77446a0..d1b00ca 100644 --- a/nodes.py +++ b/nodes.py @@ -1185,15 +1185,22 @@ class SomethingToString: "required": { "input": (any, {}), }, + "optional": { + "prefix": ("STRING", {"default": ""}), + "suffix": ("STRING", {"default": ""}), + } } RETURN_TYPES = ("STRING",) FUNCTION = "stringify" CATEGORY = "KJNodes" - def stringify(self, input): + def stringify(self, input, prefix="", suffix=""): if isinstance(input, (int, float, bool)): stringified = str(input) - print(stringified) + if prefix: # Check if prefix is not empty + stringified = prefix + stringified # Add the prefix + if suffix: # Check if suffix is not empty + stringified = stringified + suffix # Add the suffix else: return return (stringified,)