Example #1
0
        /// <summary>
        /// Convert Dec string to UInt32Array
        /// </summary>
        /// <param name="str">Dec string. For example: "1233214234 1234234234" or "21342222, 1234234234"</param>
        /// <returns></returns>
        public static UInt32Array FromString(string str)
        {
            str = str.Trim();
            UInt32Array Arr = new UInt32Array();

            string[] s = str.Split(new char[] { ',', ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < s.Length; i++)
            {
                try
                {
                    Arr.Add(Convert.ToUInt32(s[i], 10));
                }
                catch
                {
                }
            }

            return(Arr);
        }
Example #2
0
        /// <summary>
        /// Convert Hex string to UInt32Array
        /// </summary>
        /// <param name="str">Hex string. For example: "EEFFEEFFEEFFEEFF" or "EEFFEEFF EEFFEEFF" or "EEFFEEFF, EEFFEEFF"</param>
        /// <returns></returns>
        public static UInt32Array FromHexString(string str)
        {
            str = str.Trim();
            UInt32Array Arr = new UInt32Array();

            string[] s = Util.SplitString(str, new char[] { ',', ' ', '\t', '\n', '\r' }, 8);

            for (int i = 0; i < s.Length; i++)
            {
                try
                {
                    Arr.Add(Convert.ToUInt32(s[i], 16));
                }
                catch
                {
                }
            }

            return(Arr);
        }