Substring


Node Information
Gets substring from the specified string, starts from specified character position with a specified length.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Text IN String ONE FALSE FALSE
StartIndex IN Int32 ONE FALSE FALSE
Length IN Int32 ONE FALSE FALSE
Result OUT String MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.String
{
    [IsNode("Substring")]
    public class StringSubstring : Node
    {
        Port a = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Text");
        Port sindex = new Port(PortType.IN, typeof(int), AcceptsLinks.ONE, "StartIndex");
        Port length = new Port(PortType.IN, typeof(int), AcceptsLinks.ONE, "Length");
        Port res = new Port(PortType.OUT, typeof(string), AcceptsLinks.MULTIPLE, "Result");
        public StringSubstring()
        {
            NodeType = KGraph.NodeType.Function;
            ReturnType = typeof(string);
            this.Name = "Substring";
            AddPort(a);
            AddPort(sindex);
            AddPort(length);
            AddPort(res);
            Information = "Gets substring from the specified string, starts from specified character position with a specified length.";
        }
        public override string Code()
        {
            return "return " + GetValue(a) + ".Substring(" + GetValue(sindex) + "," + GetValue(length) + ");";
        }
    }
}