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 回答
1

在 vb.net - 你应该这样尝试,

 Dim stringVar As String = "[""1"",""2"",""3""]"
 stringVar.Replace("""", "")

还要检查此项以使用替换功能。

于 2015-12-14T05:18:56.903 回答