How can I split and trim a string into parts all on one line?

前端 未结 8 1152
一个人的身影
一个人的身影 2020-12-22 21:08

I want to split this line:

string line = \"First Name ; string ; firstName\";

into an array of their trimmed versions:

\"Fi         


        
8条回答
  •  清酒与你
    2020-12-22 21:15

    try using Regex :

    List parts = System.Text.RegularExpressions.Regex.Split(line, @"\s*;\s*").ToList();
    

提交回复
热议问题