/// <summary>
        ///     Extracts the subtypes from the specified attribute name.
        ///     For example, if the attribute name is cn;lang-ja;phonetic,
        ///     this method returns an array containing lang-ja and phonetic.
        /// </summary>
        /// <param name="attrName">
        ///     Name of the attribute from which to extract
        ///     the subtypes.
        /// </param>
        /// <returns>
        ///     An array subtypes or null if the attribute has none.
        ///     @throws IllegalArgumentException if attrName is null.
        /// </returns>
        public static string[] GetSubtypes(string attrName)
        {
            if (attrName == null)
            {
                throw new ArgumentException("Attribute name cannot be null");
            }

            var st = new SupportClass.Tokenizer(attrName, ";");

            string[] subTypes = null;
            var      cnt      = st.Count;

            if (cnt > 0)
            {
                st.NextToken(); // skip over basename
                subTypes = new string[cnt - 1];
                var i = 0;
                while (st.HasMoreTokens())
                {
                    subTypes[i++] = st.NextToken();
                }
            }

            return(subTypes);
        }
Пример #2
0
        /// <summary> Extracts the subtypes from the specified attribute name.
        ///
        /// For example, if the attribute name is cn;lang-ja;phonetic,
        /// this method returns an array containing lang-ja and phonetic.
        ///
        /// </summary>
        /// <param name="attrName">  Name of the attribute from which to extract
        /// the subtypes.
        ///
        /// </param>
        /// <returns> An array subtypes or null if the attribute has none.
        ///
        /// @throws IllegalArgumentException if attrName is null
        /// </returns>
        public static System.String[] getSubtypes(System.String attrName)
        {
            if ((System.Object)attrName == null)
            {
                throw new System.ArgumentException("Attribute name cannot be null");
            }
            SupportClass.Tokenizer st       = new SupportClass.Tokenizer(attrName, ";");
            System.String[]        subTypes = null;
            int cnt = st.Count;

            if (cnt > 0)
            {
                st.NextToken();                 // skip over basename
                subTypes = new System.String[cnt - 1];
                int i = 0;
                while (st.HasMoreTokens())
                {
                    subTypes[i++] = st.NextToken();
                }
            }
            return(subTypes);
        }