Ejemplo n.º 1
0
        public static string[] RemoveEmptyStrings(string[] originalArray)
        {
            var result = new StringArrayList();

            foreach (var thisString in originalArray)
            {
                var trimmedString = thisString.Trim();

                if (trimmedString.Length > 0)
                {
                    result.Add(thisString);
                }
            }

            return(result.ToStringArray());
        }
Ejemplo n.º 2
0
        public static string[] FilterArray(string[] arrayToFilter, string valueToFind, bool invert)
        {
            var result        = new StringArrayList();
            var ucValueToFind = valueToFind.ToUpper();

            foreach (var valueToCheck in arrayToFilter)
            {
                var useString = valueToCheck.ToUpper().Contains(ucValueToFind);
                if (invert)
                {
                    useString = !useString;
                }

                if (useString)
                {
                    result.Add(valueToCheck);
                }
            }

            return(result.ToStringArray());
        }
Ejemplo n.º 3
0
        public static string[] PackArray(string[] sourceArray, bool trimFirst = false)
        {
            var result = new StringArrayList();

            foreach (var thisLine in sourceArray)
            {
                if (thisLine != null)
                {
                    var lineToUse = thisLine;
                    if (trimFirst)
                    {
                        lineToUse = lineToUse.Trim();
                    }

                    if (lineToUse.Length > 0)
                    {
                        result.Add(lineToUse);
                    }
                }
            }

            return(result.ToStringArray());
        }
Ejemplo n.º 4
0
        public static string[] RemoveValues(string[] values, string[] badValues)
        {
            var result = new StringArrayList();

            foreach (var thisValue in values)
            {
                var newValue = thisValue;
                foreach (var badValue in badValues)
                {
                    newValue = StringFunctions.RemoveSubstring(newValue, badValue);
                    if (newValue.Length == 0)
                    {
                        break;
                    }
                }

                if (newValue.Length > 0)
                {
                    result.Add(newValue);
                }
            }

            return(result.ToStringArray());
        }
Ejemplo n.º 5
0
 public void Append(StringArrayList listToAppend)
 {
     Append(listToAppend.ToStringArray());
 }