How to use regular express to get the abbreviation of a string?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

for example,

Aaaa Bbbbb Ccccc Dddddd Eeeee

to ABCDE

string length may vary

Thanks
 
Matt said:
for example,

Aaaa Bbbbb Ccccc Dddddd Eeeee

to ABCDE

string length may vary

Thanks

So in reality you want to get a string where everything but upper case
letters are removed?

string abbrev = Regex.Replace(someString, "[^A-Z]+", string.Empty);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top