Hello,
I have a string, sort of like this:
“PID 0xA043 FW 116 SER# HQ1517557PE V 10000 I -10 VPV 15000 PPV 00 C”
I need to extract the value 15000, which occurs consistently one space after VPV. The command spstr splits the string upstream of an index value. So if I use:
spstr Source,Destination,"VPV ",0, it will return all the characters right up to VPV. But I need the five characters right after it. The string is not always the same length, so I can’t use a sub string, unless I know what index position the VPV occurs in.
Is there a way to search for “VPV” and find the index numbers within the string?
spstr source,dest1,”VPV “,1 // will give you everything RIGHT of “VPV “ : 15000 PPV 00 C
spstr dest1,dest2,” PPV”,0 // will then give you everything LEFT of “ PPV”in the remainder : 15000
Another way would be indexing the string parts by spaces, assuming that the value which you are looking for is always the 12th word in the string :
spstr source,dest,” “,11 delivers 15000 directly
@AKGentile1963 Assuming you found the following section in the instruction set, I wonder why it was unclear?
spstr: Split String
usage: spstr ,,,
is src .txt attribute or string data constant
is .txt attribute where result is stored
is the text delimiter encapsulated in double quotes
is zero-indexed iteration result to return
spstr “ab3cd3ef3ghi”,va1.txt,”3″,0//return string ab before first delimiter occurs
spstr “ab3cd3ef3ghi”,va1.txt,”3″,2//return string ef after second delimiter occurs
Sorry if i implied that. It’s clear, I just wanted something different.
This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).