shortest way to get first char from every word in a string

前端 未结 5 710
感情败类
感情败类 2021-01-12 05:40

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         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-12 06:18

    string str = "This is my style"; 
    str.Split(' ').ToList().ForEach(i => Console.Write(i[0] + " "));
    

提交回复
热议问题