12-19-2017 06:01 PM
Can someone help with TS string functions?
My goal is to extract the first line starting with "$GPGGA", and then separate it into an array separating at the commas.
Sample input:
$GPGGA,211332.000,4202.4046,N,08802.0322,W,1,8,0.98,274.2,M,-34.1,M,,*6C $PGTOP,3,AXN_3.20,8175,007-21-2014,GNSS_EXTRF_9600,007-05-2014,211333*03 $GPGGA,211333.000,4202.4046,N,08802.0322,W,1,8,0.98,274.2,M,-34.1,M,,*6D $GPGGA,211334.000,4202.4046,N,08802.0322,W,1,8,0.98,274.2,M,-34.1,M,,*6A $GNGSA,A,3,19,28,25,10,,,,,,,,,1.54,0.98,1.19*10
Is the "$" character special in TestStand?
FWIW in python I'd do
s.split('$GPGGA')[1].strip().split(',')
Solved! Go to Solution.
12-20-2017 09:29 AM
Hi Stephen,
Have you seen this?
Parsing a String Using Functions from the TestStand Expression Browser
http://www.ni.com/example/26308/en/
This seems to be similar to your goal.
12-20-2017 10:41 AM
Thanks, that was very helpful. Especially the combination of "Find" and "Replace".
1. search for position
Locals.position = Find( Locals.my_string, Locals.search_string )
2. Remove everything before find by replacing with empty string
Replace( Locals.my_string, 0, Locals.position, "" )
3. Repeat as needed