VB.NET 如何对JOSN解析 50
展开全部
对josn字符串,根据关键字进行提取!比如要提取:局域网这3个字
Private Sub Form_Load()
Me.AutoRedraw = True
Dim FH As String
FH = """area"":""局域网"","
Dim n As Long, m As Long, t As String, s As String
t = "area"":"
s = ""","
t = getjosn(FH, t, s)
Print t
End Sub
Function getjosn(ByVal strfh As String, ByVal strt As String, ByVal strs As String) As String
On Error GoTo myerr
Dim n As Long, m As Long, t As String, f As String
f = strfh
t = strt
n = InStr(f, t) + Len(t)
t = Right(f, Len(f) - n)
s = strs
m = InStr(t, s) - 1
t = Left(t, m)
getjosn = t
Exit Function
myerr:
getjosn = ""
End Function
Private Sub Form_Load()
Me.AutoRedraw = True
Dim FH As String
FH = """area"":""局域网"","
Dim n As Long, m As Long, t As String, s As String
t = "area"":"
s = ""","
t = getjosn(FH, t, s)
Print t
End Sub
Function getjosn(ByVal strfh As String, ByVal strt As String, ByVal strs As String) As String
On Error GoTo myerr
Dim n As Long, m As Long, t As String, f As String
f = strfh
t = strt
n = InStr(f, t) + Len(t)
t = Right(f, Len(f) - n)
s = strs
m = InStr(t, s) - 1
t = Left(t, m)
getjosn = t
Exit Function
myerr:
getjosn = ""
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询