Sha256: 490464a30c1a4a1992d7e14b46c70a53eef40d75252c7f5997a0b730263008d2
Contents?: true
Size: 457 Bytes
Versions: 281
Compression:
Stored size: 457 Bytes
Contents
using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; public static class Acronym { public static string Abbreviate(string phrase) { return Words(phrase).Aggregate("", (abbr, word) => abbr + char.ToUpperInvariant(word[0])); } private static IEnumerable<string> Words(string phrase) { return Regex.Matches(phrase, "[A-Z]+[a-z]*|[a-z]+").Cast<Match>().Select(m => m.Value); } }
Version data entries
281 entries across 281 versions & 1 rubygems