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

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -