Skip to content

Commit b2ff05e

Browse files
committed
init
0 parents  commit b2ff05e

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__pycache__/

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## ComfyUI Substring
2+
3+
Just a simple substring node that takes *text* and *length* as input, and outputs the first *length* characters.
4+
5+
To install, just git clone this repo in \ComfyUI\custom_nodes\

__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
2+
3+
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']

nodes.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
3+
class SubstringFunction:
4+
5+
def __init__(self):
6+
pass
7+
8+
@classmethod
9+
def INPUT_TYPES(cls):
10+
return {
11+
"required": {
12+
"text": ('STRING', {"multiline": True}),
13+
"length": ('INT', {"default": 75, "min": 0})
14+
}
15+
}
16+
17+
RETURN_TYPES = ('STRING',)
18+
FUNCTION = "exec"
19+
CATEGORY = "utils"
20+
OUTPUT_NODE = True
21+
22+
def exec(self, text, length):
23+
if text == "undefined":
24+
text = ""
25+
26+
out = text[:length]
27+
return {"ui": {"text": (out,)}, "result": (out,)}
28+
29+
NODE_CLASS_MAPPINGS = {
30+
"SubstringTheory": SubstringFunction,
31+
}
32+
NODE_DISPLAY_NAME_MAPPINGS = {
33+
"SubstringTheory": "Substring Node"
34+
}

0 commit comments

Comments
 (0)