Apache.NMS.Util.URISupport.SplitComponents C# (CSharp) Метод

SplitComponents() приватный статический Метод

private static SplitComponents ( String componentString ) : String[]
componentString String
Результат String[]
        private static String[] SplitComponents(String componentString)
        {
            ArrayList l = new ArrayList();

            int last = 0;
            int depth = 0;
            char[] chars = componentString.ToCharArray();
            for(int i = 0; i < chars.Length; i++)
            {
                switch(chars[i])
                {
                case '(':
                    depth++;
                    break;

                case ')':
                    depth--;
                    break;

                case ',':
                    if(depth == 0)
                    {
                        String s = componentString.Substring(last, i - last);
                        l.Add(s);
                        last = i + 1;
                    }
                    break;

                default:
                    break;
                }
            }

            String ending = componentString.Substring(last);
            if(ending.Length != 0)
            {
                l.Add(ending);
            }

            String[] rc = new String[l.Count];
            l.CopyTo(rc);
            return rc;
        }