It’s not json.
Your code looks reasonable, except that you’re not extracting as = xxx. And it might be a little fragile in that it could get “stuck” if the current line is not “PresentationContext” for whatever reason.
It’s not json.
Your code looks reasonable, except that you’re not extracting as = xxx. And it might be a little fragile in that it could get “stuck” if the current line is not “PresentationContext” for whatever reason.
[quote=345689:@Markus Winter]Split got a lot slower on 64 bit, and even with recent optimizations it’s still not up to the old speed.
See https://forum.xojo.com/29075-split-function-in-64bit-is-terribly-slow/0[/quote]
Are you saying it is still slower than 32 bit in 2017r2?
[quote=345639:@Brian O’Brien]I’m parsing a log file and extracting bits and pieces from a string that I need to build an object.
Looking at this message it looks like a JSON object to me. I’m wondering…
From here I need to extract id = n as = xxx and a list of ts = yyy
PresentationContext[id = 1, as = 1.2.840.10008.5.1.4.1.2.1.1 - Patient Root Query/Retrieve Information Model - FIND
ts = 1.2.840.10008.1.2.1 - Explicit VR Little Endian
ts = 1.2.840.10008.1.2 - Implicit VR Little Endian
]
[code]Sub Constructor(logLines() as String, byref currentLine as Integer)
dim l, ts as string
dim le, ri as integer
l = logLines(currentLine)
if l.InStr(“PresentationContext[”) <> 0 then
le = l.InStr(" = ") + 3 // id is just beside the first =
ri = l.InStr(",") -1 // id is just before the first ,
id = l.Mid(le, ri-le+1).CLong // id is between these two.
le = l.InStr(" - ") + 3
AbstractSyntax = l.Mid(le)
currentLine = currentLine + 1
while currentLine < logLines.Ubound
l = logLines(currentLine)
if l.InStr(" ]") <> 0 then
return
else
le = l.InStr(" - ") + 3
ts = l.Mid(le)
TransferSyntaxList.Append(ts)
end if
currentLine = currentLine + 1
wend
end if
End Sub[/code][/quote]
Couple of suggestions: