Last active
July 25, 2016 12:46
-
-
Save kbaesler/7474124 to your computer and use it in GitHub Desktop.
A C# method that will return the Acronym of input using LINQ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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