String Sort Characters


Node Information
Sorts the characters in the given text in alphabetical order, the result will be directly written back to the source.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Sort IN RUN MULTIPLE FALSE FALSE
Text IN String ONE FALSE FALSE
RemoveDuplicates IN Boolean ONE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.String
{
    [IsNode("Sort Characters (Direct)")]
    public class StringSortCharactersDirect : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Sort");
        Port re = new Port(PortType.IN, typeof(bool), AcceptsLinks.ONE, "RemoveDuplicates");
        Port a = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Text");
        public bool RemoveDuplicates
        {
            set { re.Value = value.ToString(); }
            get { return GetRuntimeValue(re); }
        }
        public StringSortCharactersDirect()
        {
            NodeType = NodeType.Method;
            Name = "String Sort Characters";
            AddPort(run);
            AddPort(a);
            AddPort(re);
            Information = "Sorts the characters in the given text in alphabetical order, the result will be directly written back to the source.";
        }
        public override string Code()
        {
            string removedup = string.Empty;
            if (RemoveDuplicates)
            {
                removedup = ".Distinct()";
            }
            return GetValue(a) + "= string.Concat(" + GetValue(a) + ".OrderBy(a => a)" + removedup + ");";
        }
    }
}