Iaik.Utils.SimpleFormatter.EscapeSafeSplit C# (CSharp) Method

EscapeSafeSplit() private method

private EscapeSafeSplit ( string toEscape, char splitBy ) : string[]
toEscape string
splitBy char
return string[]
        private string[] EscapeSafeSplit(string toEscape, char splitBy)
        {
            List<string> str = new List<string> ();

            int offset = 0;
            while (offset >= 0) {
                int lastOffset = offset;

                offset = FindNextNotEscaped (offset, toEscape, splitBy.ToString ());

                if (offset >= 0) {
                    str.Add (toEscape.Substring (lastOffset, offset - lastOffset));
                    offset++;
                } else
                    str.Add (toEscape.Substring (lastOffset));
            }

            return str.ToArray ();
        }