Skip to content

Instantly share code, notes, and snippets.

@kbaesler
Last active July 25, 2016 12:46
Show Gist options
  • Save kbaesler/7474124 to your computer and use it in GitHub Desktop.
Save kbaesler/7474124 to your computer and use it in GitHub Desktop.
A C# method that will return the Acronym of input using LINQ
public string GetAcronym(string input)
{
string acronym = string.Join(string.Empty, input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(s => s[0].ToString(CultureInfo.InvariantCulture)).ToArray());
return acronym
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment