Split out ints from string

前端 未结 13 1363
情歌与酒
情歌与酒 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:26

    All I can think of is to loop over the list of strings (which you have got from performing a split) and doing something like int.TryParse() on them one after the other and putting them into a new List. Encapsulate it in a nice little helper method somewhere and it won't be too horrid.

提交回复
热议问题