Answer the question
In order to leave comments, you need to log in
"Total 12 questionnaires" - replacement of the end of the word "questionnaires" depending on the number. Are there ready-made solutions?
Does anyone have a solution for this issue?
I think that if I write from scratch, then I will invent a wheel - I don’t want to)
Answer the question
In order to leave comments, you need to log in
I use this solution:
/// <summary>
/// Склонение существительных после числительных.
/// </summary>
/// <param name="iNumber">Число</param>
/// <param name="aEndings">Массив слов или окончаний для чисел (1, 4, 5)</param>
/// <returns>Вовращает вариант окончания или слова для числительного</returns>
public static string GetNumEnding(long iNumber, string[] aEndings)
{
string sEnding;
iNumber = iNumber%100;
if (iNumber >= 11 && iNumber <= 19)
{
sEnding = aEndings[2];
}
else
{
var i = iNumber%10;
switch (i)
{
case (1):
sEnding = aEndings[0];
break;
case (2):
case (3):
case (4):
sEnding = aEndings[1];
break;
default:
sEnding = aEndings[2];
break;
}
}
return sEnding;
}
GetNumEnding(notices.Count, new[] {"объявление", "объявления", "объявлений"})
Hello.
Don't mess around with this. Better change to "Total profiles - 0/1/2/38/10/100". You're just wasting your time on this crap.
At work we use morpher.ru at work , but as a dll it's paid. There is a free API.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question