Sha256: 078a5e2d9e2e1e92c0c1aeb91b63a9b06aa121ae0a454ce65faf3a1c08b2a0e9
Contents?: true
Size: 536 Bytes
Versions: 115
Compression:
Stored size: 536 Bytes
Contents
namespace Exercism { 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
115 entries across 115 versions & 1 rubygems