mirror of
https://github.com/justUmen/Bjornulf_custom_nodes.git
synced 2026-03-24 14:02:11 -03:00
v0.10
This commit is contained in:
26
loop_lines.py
Normal file
26
loop_lines.py
Normal 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,)
|
||||
Reference in New Issue
Block a user