Ejemplo n.º 1
0
        /// <summary>
        /// Check each element of a list of string
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public List <object> Replace(object a, object b, object c)
        {
            List <object> output = new List <object>();

            if (MainTools.IsList(a) && MainTools.IsString(b) && MainTools.IsString(c))
            {
                foreach (var item in (System.Collections.IEnumerable)(a))
                {
                    if (MainTools.IsString(item))
                    {
                        string container = item as string;
                        output.Add(container.Replace(b.ToString(), c.ToString()));
                    }
                }
            }
            else
            {
                if (a.GetType() == typeof(string) && MainTools.IsString(b) && MainTools.IsString(c))

                {
                    string container = a as string;
                    output.Add(container.Replace(b.ToString(), c.ToString()));
                }
            }
            return(output);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check each element of a list of string
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public List <object> Contains(object a, object b)
        {
            List <object> output = new List <object>();

            if (MainTools.IsList(a) & MainTools.IsString(b))
            {
                foreach (var item in (System.Collections.IEnumerable)(a))
                {
                    if (MainTools.IsString(item))
                    {
                        string container = item as string;
                        output.Add(container.Contains(b as string));
                    }
                }
            }
            return(output);
        }