Novell.Directory.Ldap.LdapUrl.parseList C# (CSharp) Method

parseList() private method

private parseList ( System listStr, char delimiter, int listStart, int listEnd ) : System.String[]
listStr System
delimiter char
listStart int
listEnd int
return System.String[]
        private System.String[] parseList(System.String listStr, char delimiter, int listStart, int listEnd)
        {
            System.String[] list;
            // Check for and empty string
            if ((listEnd - listStart) < 1)
            {
                return null;
            }
            // First count how many items are specified
            int itemStart = listStart;
            int itemEnd;
            int itemCount = 0;
            while (itemStart > 0)
            {
                // itemStart == 0 if no delimiter found
                itemCount += 1;
                itemEnd = listStr.IndexOf((System.Char) delimiter, itemStart);
                if ((itemEnd > 0) && (itemEnd < listEnd))
                {
                    itemStart = itemEnd + 1;
                }
                else
                {
                    break;
                }
            }
            // Now fill in the array with the attributes
            itemStart = listStart;
            list = new System.String[itemCount];
            itemCount = 0;
            while (itemStart > 0)
            {
                itemEnd = listStr.IndexOf((System.Char) delimiter, itemStart);
                if (itemStart <= listEnd)
                {
                    if (itemEnd < 0)
                        itemEnd = listEnd;
                    if (itemEnd > listEnd)
                        itemEnd = listEnd;
                    list[itemCount] = listStr.Substring(itemStart, (itemEnd) - (itemStart));
                    itemStart = itemEnd + 1;
                    itemCount += 1;
                }
                else
                {
                    break;
                }
            }
            return list;
        }