/// <summary>
        /// Parses a string to produce a <see cref="Complex"/> object.
        /// </summary>
        /// <param name="source">the string to parse</param>
        /// <param name="pos">input/ouput parsing parameter.</param>
        /// <returns>the parsed <c>Complex</c> object.</returns>
        public Complex parse(String source, Int32 pos)
        {
            int initialIndex = pos;

            // parse whitespace
            Int32 nonSpace = CompositeFormat.parseAndIgnoreWhitespace(source, pos);

            // parse real
            Double re = CompositeFormat.parseNumber(source, CultureInfo.CurrentCulture);

            if (Double.IsNaN(re))
            {
                // invalid real number
                // set index back to initial, error index should already be set
                return(null);
            }

            // parse sign
            Int32 p    = CompositeFormat.parseNextCharacter(source, nonSpace);
            char  c    = source[p];
            int   sign = 0;

            switch (c)
            {
            case '0':
                // no sign
                // return real only complex number
                return(new Complex(re, 0.0));

            case '-':
                sign = -1;
                break;

            case '+':
                sign = 1;
                break;

            default:
                // invalid sign
                // set index back to initial, error index should be the last
                // character examined.
                return(null);
            }

            // parse whitespace
            CompositeFormat.parseAndIgnoreWhitespace(source, pos);

            // parse imaginary
            Double im = CompositeFormat.parseNumber(source, CultureInfo.CurrentCulture);

            if (Double.IsNaN(im))
            {
                // invalid imaginary number
                // set index back to initial, error index should already be set
                return(null);
            }

            // parse imaginary character
            if (!CompositeFormat.parseFixedstring(source, getImaginaryCharacter()))
            {
                return(null);
            }
            return(new Complex(re, im * sign));
        }