Easiest way to parse a comma delimited string to some kind of object I can loop through to access the individual values?

前端 未结 7 690
予麋鹿
予麋鹿 2020-11-28 06:57

What is the easiest way to parse a comma delimited string list of values into some kind of object that I can loop through, so that I can access the individual values easily?

7条回答
  •  长情又很酷
    2020-11-28 07:28

    Use a loop on the split values

    string values = "0,1,2,3,4,5,6,7,8,9";
    
    foreach(string value in values.split(','))
    {
        //do something with individual value
    }
    

提交回复
热议问题