CSharpAnalytics.Protocols.Urchin.UtmeEncoder.Compress C# (CSharp) Метод

Compress() публичный статический Метод

Compress an array of values into a Utme compressed array by skipping empty elements and prefixing the next one with an offset.
public static Compress ( string uncompressed ) : string[]
uncompressed string Original uncompressed array of values
Результат string[]
        public static string[] Compress(string[] uncompressed)
        {
            if (uncompressed == null) throw new ArgumentNullException("uncompressed");

            var compressed = new List<string>();
            var compressedIndex = 0;

            for (var i = 0; i < uncompressed.Length; i++)
            {
                var value = uncompressed[i];
                if (!String.IsNullOrWhiteSpace(value))
                {
                    if (i == compressedIndex)
                    {
                        compressed.Add(value);
                        compressedIndex++;
                    }
                    else
                    {
                        compressed.Add(i + 1 + "!" + value);
                        compressedIndex = i + 1;
                    }
                }
            }

            return compressed.ToArray();
        }