Skip to content

Instantly share code, notes, and snippets.

@pertsevds
Last active April 17, 2021 15:39
Show Gist options
  • Save pertsevds/f4e20ec4252666576d782cdc89584073 to your computer and use it in GitHub Desktop.
Save pertsevds/f4e20ec4252666576d782cdc89584073 to your computer and use it in GitHub Desktop.
Pluralize rubles C#
using System;
namespace Pluralize
{
public static class PluralizeTask
{
public static string PluralizeRubles(int count)
{
if (count % 10 == 1 && count % 100 != 11)
return "рубль";
if (Array.IndexOf(new[] { 2, 3, 4 }, count % 10) != -1 &&
Array.IndexOf(new[] { 12, 13, 14 }, count % 100) == -1)
return "рубля";
return "рублей";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment