コード例 #1
0
 public static bool TryGetMatchedSuffixForWord(string word, IEnumerable <string> suffixes, CultureInfo culture, out string matchedSuffix)
 {
     matchedSuffix = null;
     if (PluralizationServiceUtil.DoesWordContainSuffix(word, suffixes, culture))
     {
         matchedSuffix = suffixes.First((string s) => word.EndsWith(s, true, culture));
         return(true);
     }
     return(false);
 }
コード例 #2
0
        public static bool TryInflectOnSuffixInWord(string word, IEnumerable <string> suffixes, Func <string, string> operationOnWord, CultureInfo culture, out string newWord)
        {
            newWord = null;
            string text;

            if (PluralizationServiceUtil.TryGetMatchedSuffixForWord(word, suffixes, culture, out text))
            {
                newWord = operationOnWord(word);
                return(true);
            }
            return(false);
        }