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
}
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
}
2
Answers
I suggest using Regular Expressions here and match these two words. If we assume that the word of interes must start from capital letter and must continue with low case leters we can implement it it like this:
Here we use
p{Lu}p{Ll}+
which isFiddle
You’re almost there: Just
.Take(2)