diff --git a/src/Artemis.VisualScripting/Nodes/Text/StringLengthNode.cs b/src/Artemis.VisualScripting/Nodes/Text/StringLengthNode.cs index f6a09ef66..421ad4dec 100644 --- a/src/Artemis.VisualScripting/Nodes/Text/StringLengthNode.cs +++ b/src/Artemis.VisualScripting/Nodes/Text/StringLengthNode.cs @@ -2,12 +2,12 @@ namespace Artemis.VisualScripting.Nodes.Text; -[Node("String Length", "Checks whether the first input is contained in the second input.", +[Node("Text Length", "Outputs the length of the input text.", "Text", InputType = typeof(string), OutputType = typeof(Numeric))] public class StringLengthNode : Node { public StringLengthNode() - : base("String Length", "Returns string length.") + : base("Text Length", "Outputs text length.") { Input1 = CreateInputPin(); Result = CreateOutputPin(); @@ -19,6 +19,6 @@ public class StringLengthNode : Node public override void Evaluate() { - Result.Value = new Numeric((Input1.Value ?? "").Length); + Result.Value = Input1.Value == null ? new Numeric(0) : new Numeric(Input1.Value.Length); } } \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Text/StringNullOrEmptyNode.cs b/src/Artemis.VisualScripting/Nodes/Text/StringNullOrEmptyNode.cs new file mode 100644 index 000000000..80db0442c --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Text/StringNullOrEmptyNode.cs @@ -0,0 +1,25 @@ +using Artemis.Core; + +namespace Artemis.VisualScripting.Nodes.Text; + +[Node("Text is empty", "Outputs true if the input text is empty, false if it contains any text.", + "Text", InputType = typeof(string), OutputType = typeof(bool))] +public class StringNullOrEmptyNode : Node +{ + public StringNullOrEmptyNode() + : base("Text is empty", "Outputs true if empty") + { + Input1 = CreateInputPin(); + Output1 = CreateOutputPin("true"); + } + + public InputPin Input1 { get; } + + public OutputPin Output1 { get; } + + public override void Evaluate() + { + bool isNullOrWhiteSpace = string.IsNullOrWhiteSpace(Input1.Value); + Output1.Value = isNullOrWhiteSpace; + } +} \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Text/StrıngNullOrEmpty.cs b/src/Artemis.VisualScripting/Nodes/Text/StrıngNullOrEmpty.cs deleted file mode 100644 index 705946cdb..000000000 --- a/src/Artemis.VisualScripting/Nodes/Text/StrıngNullOrEmpty.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Artemis.Core; - -namespace Artemis.VisualScripting.Nodes.Text; - -[Node("String Null or WhiteSpace", "Checks whether the string is null, empty or white space.", - "Text", InputType = typeof(string), OutputType = typeof(bool))] -public class StringNullOrWhiteSpaceNode : Node -{ - public StringNullOrWhiteSpaceNode() - : base("Null or White Space", "Returns true if null or white space") - { - Input1 = CreateInputPin(); - NullOrWhiteSpaceResult = CreateOutputPin("true"); - HasContentResult = CreateOutputPin("false"); - } - - public InputPin Input1 { get; } - - public OutputPin NullOrWhiteSpaceResult { get; } - - public OutputPin HasContentResult { get; } - - public override void Evaluate() - { - bool isNullOrWhiteSpace = string.IsNullOrWhiteSpace(Input1.Value); - NullOrWhiteSpaceResult.Value = isNullOrWhiteSpace; - HasContentResult.Value = !isNullOrWhiteSpace; - } -} \ No newline at end of file