1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

added string lLength and IsNullOrEmpty nodes

This commit is contained in:
aytac.kayadelen 2022-08-24 11:15:29 +03:00
parent f96bf05820
commit e54e791062
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,24 @@
using Artemis.Core;
namespace Artemis.VisualScripting.Nodes.Text;
[Node("String Length", "Checks whether the first input is contained in the second input.",
"Text", InputType = typeof(string), OutputType = typeof(Numeric))]
public class StringLengthNode : Node
{
public StringLengthNode()
: base("String Length", "Returns string length.")
{
Input1 = CreateInputPin<string>();
Result = CreateOutputPin<Numeric>();
}
public InputPin<string> Input1 { get; }
public OutputPin<Numeric> Result { get; }
public override void Evaluate()
{
Result.Value = new Numeric((Input1.Value ?? "").Length);
}
}

View File

@ -0,0 +1,29 @@
using Artemis.Core;
namespace Artemis.VisualScripting.Nodes.Text;
[Node("String Null or WhiteSpace", "Checks whether the string is null 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<string>();
TrueResult = CreateOutputPin<bool>("true (Empty)");
FalseResult = CreateOutputPin<bool>("false (Not Empty)");
}
public InputPin<string> Input1 { get; }
public OutputPin<bool> TrueResult { get; }
public OutputPin<bool> FalseResult { get; }
public override void Evaluate()
{
bool isNullOrWhiteSpace = string.IsNullOrWhiteSpace(Input1.Value);
TrueResult.Value = isNullOrWhiteSpace;
FalseResult.Value = !isNullOrWhiteSpace;
}
}