Convert string array to int array

后端 未结 6 1487
名媛妹妹
名媛妹妹 2021-02-04 03:42

I have tried a couple different ways and cannot seem to get the result I want using vb.net.

I have an array of strings. {\"55555 \",\"44444\", \" \"}

I need an

6条回答
  •  名媛妹妹
    2021-02-04 04:02

    My $.02

        Dim stringList() As String = New String() {"", "123", "456", "789", "a"}
        Dim intList() As Integer
    
        intList = (From str As String In stringList
                   Where Integer.TryParse(str, Nothing)
                   Select (Integer.Parse(str))).ToArray
    

提交回复
热议问题