Split out ints from string

前端 未结 13 1505
情歌与酒
情歌与酒 2021-01-17 17:45

Let\'s say I have a web page that currently accepts a single ID value via a url parameter:
http://example.com/mypage.aspx?ID=1234

I want to change it to acce

13条回答
  •  半阙折子戏
    2021-01-17 18:10

    split is the first thing that comes to mind, but that returns an array, not a List; you could try something like:

    
    List intList = new List;
    
    foreach (string tempString in ids.split(',')
    {
        intList.add (convert.int32(tempString));
    }
    
    

提交回复
热议问题