regex - Is there a better way to create acronym from upper letters in C#? -
what best way create acronym upper letters in c#?
example:
alfa_betagamedelta_epsilon
expected result:
abgde
my solution works, it's not nice
var classnameabbreviationregex = new regex("[a-z]+", regexoptions.compiled); var matches = classnameabbreviationregex.matches(enumtypename); var letters = new string[matches.count]; (var = 0; < matches.count; i++) { letters[i] = matches[i].value; } var abbreviation = string.join(string.empty, letters);
string.join("", s.where(char.isupper));
Comments
Post a Comment