I'm receiving some Cursor on Target data via UDP packets in a windows form, and I wanna use certain elements from it like the value of speed, course, lat, lon etc., but I'm struggling to find a good solution for this.
This is the string coming in:
<event how="m-i" time="2020-04-06T07:23:07.00Z" start="2020-04-06T07:23:07.00Z" stale="2020-04-06T07:23:22.00Z" version="2.0" type="a-f-A-M-F-Q" uid="ACRFT_TEST.00052">
<point lat="55.6058278913" lon="8.4713637745" hae="53.968786" ce="16" le="12" />
<detail>
<track version="0.1" course="63.426428" speed="1.72" slope="-0.18" />
</detail>
</event>
In this example I wanna use the value of "speed", but the number of digits following the speed="
is varying depending on the actual speed so i can't just use x number of characters after speed="
.
So the best way would be to search the string for speed="
and then use all the characters after that, until the next "
, so the output would be 1.72
(maybe using REGEX?) but so far, I have failed to accomplish this.
Can anyone help me out on this one?