如何在字符串下面转换
"[""1"",""2"",""3""]"
对此,
["1","2","3"]
我试过这个没有成功:
Replace(string, """", "")
答案 0 :(得分: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
答案 1 :(得分:1)
在vb.net中 - 你应该尝试这样,
Dim stringVar As String = "[""1"",""2"",""3""]"
stringVar.Replace("""", "")
同时检查this以使用替换功能。