I want a shortest way to get 1st char of every word in a string in C#.
what I have done is:
string str = \"This is my style\"; string [] output = str
var firstChars = str.Split(' ').Select(s => s[0]);
If the performance is critical:
var firstChars = str.Where((ch, index) => ch != ' ' && (index == 0 || str[index - 1] == ' '));
The second solution is less readable, but loop the string once.