예제 #1
0
            public override Cell Evaluate(SpoolSpace Memory)
            {
                this.CheckParameters();
                Cell      Value       = this._Children[0].Evaluate(Memory);
                Cell      SplitValues = this._Children[1].Evaluate(Memory);
                CellArray z           = new CellArray();

                // Two parameters //
                if (this._Children.Count == 2)
                {
                    if (Value.Affinity == CellAffinity.BINARY)
                    {
                        BString x = new BString(Value.valueBINARY);
                        foreach (BString y in x.Split(SplitValues.valueBINARY))
                        {
                            z.Append(new Cell(y.ToByteArray));
                        }
                    }
                    else if (Value.Affinity == CellAffinity.BSTRING)
                    {
                        foreach (BString y in Value.valueBSTRING.Split(SplitValues.valueBINARY))
                        {
                            z.Append(new Cell(y));
                        }
                    }
                    else if (Value.Affinity == CellAffinity.CSTRING)
                    {
                        foreach (string y in Util.StringUtil.Split(Value.valueCSTRING, SplitValues.valueCSTRING.ToCharArray()))
                        {
                            z.Append(new Cell(y));
                        }
                    }

                    return(z);
                }

                // Three paramters
                Cell Escape = this._Children[2].Evaluate(Memory);

                if (Value.Affinity == CellAffinity.BINARY)
                {
                    BString x = new BString(Value.valueBINARY);
                    foreach (BString y in x.Split(SplitValues.valueBINARY, Escape.valueBYTE))
                    {
                        z.Append(new Cell(y.ToByteArray));
                    }
                }
                else if (Value.Affinity == CellAffinity.BSTRING)
                {
                    foreach (BString y in Value.valueBSTRING.Split(SplitValues.valueBINARY, Escape.valueBYTE))
                    {
                        z.Append(new Cell(y));
                    }
                }
                else if (Value.Affinity == CellAffinity.CSTRING)
                {
                    foreach (string y in Util.StringUtil.Split(Value.valueCSTRING, SplitValues.valueCSTRING.ToCharArray(), Escape.valueCSTRING.ToCharArray()[0]))
                    {
                        z.Append(new Cell(y));
                    }
                }

                return(z);
            }