This commit is contained in:
justumen
2024-08-12 12:11:41 +02:00
parent 81166137fb
commit ee35bd5575
4 changed files with 36 additions and 2 deletions

26
loop_lines.py Normal file
View File

@@ -0,0 +1,26 @@
class LoopAllLines:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"text": ("STRING", {"forceInput": True}),
}
}
RETURN_TYPES = ("STRING",)
FUNCTION = "all_lines"
OUTPUT_IS_LIST = (True,)
CATEGORY = "Bjornulf"
def all_lines(self, text):
# Split the input text into lines
lines = text.split('\n')
# Remove empty lines and strip whitespace
lines = [line.strip() for line in lines if line.strip()]
if not lines:
return ([],)
# Return all non-empty lines
return (lines,)