예제 #1
0
        /// <summary>
        /// Is the <paramref name="string"/> a pangram?
        /// </summary>
        /// <param name="string">The <see cref="String"/> to check.</param>
        /// <param name="orthography">The orthography to use.</param>
        /// <returns>
        /// <para>Pangrams are text in which each glyph in the orthography is present.</para>
        /// </returns>
        public static Boolean IsPangram(this String @string, Orthography orthography)
        {
            OrthographyCounter counter = orthography.GetCounter();

            counter.Add(@string);
            foreach (Int32 count in counter.Values)
            {
                if (count == 0)
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Is the <paramref name="string"/> an isogram?
        /// </summary>
        /// <param name="string">The <see cref="String"/> to check.</param>
        /// <param name="orthography">The orthography to use.</param>
        /// <param name="order">The order of the isogram.</param>
        /// <returns><see langword="true"/> if isogram; otherwise, <see langword="false"/>.</returns>
        /// <remarks>
        /// <para>Isograms are text in which each glyph that is present, is present the same number of times.</para>
        /// </remarks>
        public static Boolean IsIsogram(this String @string, Orthography orthography, out Int32 order)
        {
            OrthographyCounter counter = orthography.GetCounter();

            counter.Add(@string);
            order = 0;
            foreach (Int32 count in counter.Values)
            {
                if (order == 0 && count != 0)
                {
                    order = count;
                }
                if (count != order && count != 0)
                {
                    return(false);
                }
            }
            return(true);
        }