CSharp examples for System.Globalization:English
Make name Plural
using System.Text.RegularExpressions; using System.Text; using System.Linq; using System.Collections.Specialized; using System.Collections.Generic; public class Main{ public static string MakePlural(string name) {/*from w w w .jav a2 s . c o m*/ if (name.EndsWith("ch") || name.EndsWith("s")) name += "es"; else if (name.EndsWith("y") && !name.EndsWith("ay")) name = name.Substring(0, name.Length - 1) + "ies"; else name += "s"; return name; } }