예제 #1
0
파일: NameParser.cs 프로젝트: rahodges/Amns
        /// <summary>
        /// Tests to see if the string is a prefix and returns true if it is. In addition,
        /// it will provide a Formatted Version of a prefix for abbreviations.
        /// </summary>
        /// <param name="s">String to test.</param>
        /// <param name="formattedPrefix">String reference to pass formatted prefix.</param>
        /// <returns>True if string is a prefix; false if not.</returns>
        private bool isPrefix(string s, out string formattedPrefix)
        {
            string testPrefix;

            for (int x = 0; x <= Prefixes.GetUpperBound(0); x++)
            {
                testPrefix = s.ToUpper();
                if (testPrefix == Prefixes[x, 0].ToUpper() |
                    testPrefix.Replace(".", string.Empty) == Prefixes[x, 1].ToUpper().Replace(".", string.Empty))
                {
                    formattedPrefix = Prefixes[x, 1];
                    return(true);
                }
            }

            formattedPrefix = s;

            return(false);
        }