VB操作JSON的例子很少,今天土嘎嘎小编发布一款VB6JSON字符串, vb JSON解析,VB6操作JSON字符串的全面操作源码分享
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Private m_sString As String
Private m_iChunkSize As Long
Private m_iPos As Long
Private m_iLen As Long
Public Property Get Length() As Long
Length = m_iPos \ 2
End Property
Public Property Get Capacity() As Long
Capacity = m_iLen \ 2
End Property
Public Property Get ChunkSize() As Long
' Return the unicode character chunk size:
ChunkSize = m_iChunkSize \ 2
End Property
Public Property Let ChunkSize(ByVal iChunkSize As Long)
' Set the chunksize. We multiply by 2 because internally
' we are considering bytes:
m_iChunkSize = iChunkSize * 2
End Property
Public Property Get toString() As String
' The internal string:
If m_iPos > 0 Then
toString = Left$(m_sString, m_iPos \ 2)
End If
End Property
Public Property Let TheString(ByRef sThis As String)
Dim lLen As Long
' Setting the string:
lLen = LenB(sThis)
If lLen = 0 Then
'Clear
m_sString = ""
m_iPos = 0
m_iLen = 0
Else
If m_iLen < lLen Then
' Need to expand string to accommodate:
.......................................................