How to get only the first letter of the first 2 words of a long string?

Advertisements

I have a long string name. Example: "Ahmet Enes Söylemez". I want to get only "AE" letters from this array. How can I do it ?

@{ string result = string.Concat(kullanici.AdSoyad.Where(char.IsUpper));
@result
 }

>Solution :

You’re almost there: Just .Take(2)

string result = string.Concat(kullanici.AdSoyad.Where(char.IsUpper).Take(2));

Leave a Reply Cancel reply