0

以下の文字列を変換するにはどうすればよいですか、

"[""1"",""2"",""3""]"

これに、

["1","2","3"]

私は成功せずにこれを試しました:

Replace(string, """", "")
4

2 に答える 2

1

私が正しく理解していれば、次のようなことを試すことができます:

Dim s As String = "[""1"",""2"",""3""]"
Dim collection As System.Text.RegularExpressions.MatchCollection = System.Text.RegularExpressions.Regex.Matches(s, "\d+")

Dim svals As String = ""
For Each m As System.Text.RegularExpressions.Match In collection
    If svals = String.Empty Then
         svals = m.Value
    Else
         svals = svals & "," & m.Value
    End If

Next

Dim rr() As String 

rr = svals.Split(",") ' Result as array of string

Demo

于 2015-12-14T05:04:40.057 に答える