Example #1
0
        public static List <string> Split(this List <string> Items, StringSplitType Type, StringSplitOptions Options)
        {
            switch (Type)
            {
            case StringSplitType.Word:
            {
                return(Items.SplitWords(Options));
            }

            case StringSplitType.Fragment:
            {
                return(Items.SplitFragment(Options));
            }

            case StringSplitType.Sentence:
            {
                return(Items.SplitSentence(Options));
            }

            case StringSplitType.Line:
            {
                return(Items.SplitLine(Options));
            }
            }

            return(Items.SplitWords(Options));
        }
Example #2
0
        /// <summary>Generates an object from its XML representation.</summary>
        /// <param name="reader">
        ///     The <see cref="T:System.Xml.XmlReader" /> stream from which the object is
        ///     deserialized.
        /// </param>
        public override void ReadXml(XmlReader reader)
        {
            base.ReadXml(reader);
            this.Separator = reader.GetAttribute("Separator");
            this.SplitType = (StringSplitType)Enum.Parse(typeof(StringSplitType), reader.GetAttribute("SplitType"));
            this.AsEnum    = bool.Parse(reader.GetAttribute("AsEnum"));

            reader.ReadStartElement();

            this.Dictionary = new string[int.Parse(reader.GetAttribute("Length"))];
            reader.ReadStartElement("Dictionary");
            for (var i = 0; i < this.Dictionary.Length; i++)
            {
                this.Dictionary[i] = reader.ReadElementString("item");
            }

            reader.ReadEndElement();

            this.Exclude = new string[int.Parse(reader.GetAttribute("Length"))];
            reader.ReadStartElement("Exclude");
            for (var i = 0; i < this.Exclude.Length; i++)
            {
                this.Exclude[i] = reader.ReadElementString("item");
            }
        }
Example #3
0
        public static string[] Split(this string Value, StringSplitType Type, StringSplitOptions Options)
        {
            switch (Type)
            {
            case StringSplitType.Word:
            {
                return(Value.SplitWords(Options));
            }

            case StringSplitType.Fragment:
            {
                return(Value.SplitFragment(Options));
            }

            case StringSplitType.Sentence:
            {
                return(Value.SplitSentence(Options));
            }

            case StringSplitType.Line:
            {
                return(Value.SplitLine(Options));
            }

            case StringSplitType.Block:
            {
                return(Value.SplitBlock(Options));
            }
            }

            return(Value.SplitWords(Options));
        }
Example #4
0
 /// <summary>Adds string property to descriptor with previously chained name.</summary>
 /// <param name="splitType">How to split string.</param>
 /// <param name="separator">(Optional) Separator to use.</param>
 /// <param name="exclusions">(Optional) file describing strings to exclude.</param>
 /// <returns>descriptor with added property.</returns>
 public Descriptor AsString(StringSplitType splitType, string separator = " ", string exclusions = null)
 {
     StringProperty p = new StringProperty();
     p.Name = _name;
     p.SplitType = splitType;
     p.Separator = separator;
     p.ImportExclusions(exclusions);
     p.AsEnum = _label;
     AddProperty(p);
     return _descriptor;
 }
Example #5
0
        /// <summary>Adds string property to descriptor with previously chained name.</summary>
        /// <param name="splitType">How to split string.</param>
        /// <param name="separator">(Optional) Separator to use.</param>
        /// <param name="exclusions">(Optional) file describing strings to exclude.</param>
        /// <returns>descriptor with added property.</returns>
        public Descriptor AsString(StringSplitType splitType, string separator = " ", string exclusions = null)
        {
            StringProperty p = new StringProperty();

            p.Name      = _name;
            p.SplitType = splitType;
            p.Separator = separator;
            p.ImportExclusions(exclusions);
            p.AsEnum = _label;
            AddProperty(p);
            return(_descriptor);
        }
Example #6
0
        /// <summary>Adds string property to descriptor with previously chained name.</summary>
        /// <param name="splitType">How to split string.</param>
        /// <param name="separator">(Optional) Separator to use.</param>
        /// <param name="exclusions">(Optional) file describing strings to exclude.</param>
        /// <returns>descriptor with added property.</returns>
        public Descriptor AsString(StringSplitType splitType, string separator = " ", string exclusions = null)
        {
            var p = new StringProperty
            {
                Name      = _name,
                SplitType = splitType,
                Separator = separator,
                AsEnum    = _label
            };

            p.ImportExclusions(exclusions);
            AddProperty(p);
            return(_descriptor);
        }
Example #7
0
 public StringFeatureAttribute(StringSplitType splitType, string separator = " ", string exclusions = null)
 {
     SplitType = splitType;
     Separator = separator;
     ExclusionFile = exclusions;
 }
 /// <summary>Constructor.</summary>
 /// <param name="splitType">Type of the split.</param>
 /// <param name="separator">(Optional) the separator.</param>
 /// <param name="exclusions">(Optional) the exclusions.</param>
 public StringFeatureAttribute(StringSplitType splitType, string separator = " ", string exclusions = null)
 {
     SplitType     = splitType;
     Separator     = separator;
     ExclusionFile = exclusions;
 }
Example #9
0
        public override void ReadXml(XmlReader reader)
        {
            base.ReadXml(reader);
            Separator = reader.GetAttribute("Separator");
            SplitType = (StringSplitType)Enum.Parse(typeof(StringSplitType), reader.GetAttribute("SplitType"));
            AsEnum = bool.Parse(reader.GetAttribute("AsEnum"));

            reader.ReadStartElement();

            Dictionary = new string[int.Parse(reader.GetAttribute("Length"))];
            reader.ReadStartElement("Dictionary");
            for (int i = 0; i < Dictionary.Length; i++)
                Dictionary[i] = reader.ReadElementString("item");
            reader.ReadEndElement();

            Exclude = new string[int.Parse(reader.GetAttribute("Length"))];
            reader.ReadStartElement("Exclude");
            for (int i = 0; i < Exclude.Length; i++)
                Exclude[i] = reader.ReadElementString("item");
        }
Example #10
0
 public static List <string> Split(this List <string> Items, StringSplitType Type)
 {
     return(Items.Split(Type, StringSplitOptions.RemoveEmptyEntries));
 }
Example #11
0
 public static string[] Split(this string Value, StringSplitType Type)
 {
     return(Value.Split(Type, StringSplitOptions.RemoveEmptyEntries));
 }