// - - - - -

        /// <summary>
        /// Do parse the string strictly to a <see cref="BirthDateParseResult"/> using a format string..
        /// </summary>
        /// <param name="str">The string.</param>
        /// <param name="format">The format.</param>
        /// <remarks>
        /// Can only pase a string with a format with the year, month and day specified as numbers or month by name.
        /// </remarks>
        /// <returns></returns>
        private BirthDateParseResult DoStrictParse(string str, string format)
        {
            var result = new BirthDateParseResult()
            {
                Success = true
            };

            int formatPos = 0;
            int tokenLenFormatString;

            int parsePos = 0;
            int tokenLenParseString;

            while (formatPos < format.Length)
            {
                DoStrictParse(result, format, formatPos, str, parsePos, out tokenLenFormatString, out tokenLenParseString);
                formatPos += tokenLenFormatString;
                parsePos  += tokenLenParseString;

                if (!result.Success)
                {
                    break;
                }
            }

            result.Success &=
                result.YearIsFound &&
                result.MonthIsFound &&
                result.DayIsFound &&
                parsePos == str.Length &&
                result.DayMatchesDate();

            return(result);
        }
        /// <summary>
        /// Gets the length of the day format part and put this into <see cref="BirthDateParseResult.DayFormatPartLength"/>
        /// and return it. Also set <see cref="BirthDateParseResult.DayIsText"/>.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <param name="format">The format.</param>
        /// <param name="pos">The position.</param>
        /// <returns></returns>
        /// <seealso cref="Format.BirthDateFormat.FormatDay(System.Text.StringBuilder, string, int, int, DateTime)"/>
        private int GetFormatPartDay(BirthDateParseResult result, string format, int pos)
        {
            int tokenLen = FormatHelper.ParseLengthOfRepeatPattern(format, pos, 'd');

            result.DayFormatPartLength = tokenLen;
            result.DayIsText           = tokenLen >= 3;

            return(tokenLen);
        }
        /// <summary>
        /// Fills in all the information about the day at the current position and put this information
        /// into <paramref name="result"/>. This includes the actual parsed day, wheter the day was masked,
        /// if the year was day and if the parsing was successfull so far.
        /// Returns the length of the parsed part.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <param name="str">The string.</param>
        /// <param name="pos">The position.</param>
        /// <returns></returns>
        /// <seealso cref="Format.BirthDateFormat.FormatDay(System.Text.StringBuilder, string, int, int, DateTime)"/>
        private int ParseDay(BirthDateParseResult result, string str, int pos)
        {
            bool oldDayIsFound = result.DayIsFound;

            result.DayIsFound = true;

            var fullTextMask   = new String(_birthDateParseInfo.TextMaskChar, result.DayFormatPartLength);
            var fullNumberMask = new String(_birthDateParseInfo.NumberMaskChar, result.DayFormatPartLength);

            if (FindString(str, pos, new[] { fullTextMask, fullNumberMask }, false, out int len1, out int obsoleteIndex) &&
                (!result.DayIsReal.HasValue || !result.DayIsReal.Value))    // Masked
            {
                result.Day       = 0;
                result.DayIsReal = false;
                return(len1);
            }
        /// <summary>
        /// Do parse the <paramref name="str"/> strictly to a <see cref="BirthDateParseResult"/> using a <paramref name="format"/>..
        /// </summary>
        /// <param name="result">The result.</param>
        /// <param name="format">The format.</param>
        /// <param name="formatPos">The format position.</param>
        /// <param name="str">The string.</param>
        /// <param name="parsePos">The parse position.</param>
        /// <param name="tokenLenFormatString">The token length format string.</param>
        /// <param name="tokenLenParseString">The token length parse string.</param>
        private void DoStrictParse(BirthDateParseResult result, string format, int formatPos, string str, int parsePos, out int tokenLenFormatString, out int tokenLenParseString)
        {
            switch (format[formatPos])
            {
            case 'd':
                tokenLenFormatString = GetFormatPartDay(result, format, formatPos);
                tokenLenParseString  = ParseDay(result, str, parsePos);
                break;

            case 'M':
                tokenLenFormatString = GetFormatPartMonth(result, format, formatPos);
                tokenLenParseString  = ParseMonth(result, str, parsePos);
                break;

            case 'y':
                tokenLenFormatString = GetFormatPartYear(result, format, formatPos);
                tokenLenParseString  = ParseYear(result, str, parsePos);
                break;

            case '/':
                tokenLenFormatString = 1;
                tokenLenParseString  = ParsePartDateSeparator(result, str, parsePos);
                break;

            case '\'':
            case '\"':
                tokenLenFormatString = FormatHelper.GetQuotedTextLength(format, formatPos);
                tokenLenParseString  = tokenLenFormatString - 2;
                break;

            case '%':
                tokenLenFormatString = FormatHelper.GetNextCharLength(format, formatPos, out char nextChar);
                tokenLenParseString  = ParseNextChar(result, str, parsePos, nextChar);
                break;

            case '\\':
                tokenLenFormatString = FormatHelper.GetEscapedCharLength(format, formatPos);
                tokenLenParseString  = 1;
                break;

            default:
                tokenLenFormatString = 1;
                tokenLenParseString  = 1;
                result.Success       = format[formatPos] == str[parsePos];
                break;
            }
        }