mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
24 lines
667 B
C#
24 lines
667 B
C#
using Artemis.Core;
|
|
|
|
namespace Artemis.VisualScripting.Nodes.Text;
|
|
|
|
[Node("Text Length", "Outputs the length of the input text.",
|
|
"Text", InputType = typeof(string), OutputType = typeof(Numeric))]
|
|
public class StringLengthNode : Node
|
|
{
|
|
public StringLengthNode()
|
|
: base("Text Length", "Outputs text length.")
|
|
{
|
|
Input1 = CreateInputPin<string>();
|
|
Result = CreateOutputPin<Numeric>();
|
|
}
|
|
|
|
public InputPin<string> Input1 { get; }
|
|
|
|
public OutputPin<Numeric> Result { get; }
|
|
|
|
public override void Evaluate()
|
|
{
|
|
Result.Value = Input1.Value == null ? new Numeric(0) : new Numeric(Input1.Value.Length);
|
|
}
|
|
} |