I just updated to the latest CR1000X OS 8.4 (previous version not available) and several methods seem to have changed but I cannot find it in the OS change logs. For example, an operational script that has been working for some time used SplitStr as follows:
numparms = SplitStr(stream, item(), " ")
The declarations for the above are:
Dim item(41) As String * 20, stream as String * 500, numparms as Long
Previously, SplitStr returned the number of filter strings found which was used as the basis for the number of passes through a for-next loop. Now, the "numparms =" causes a compiler error and the destination array and string to be split positions are reversed in addition to additional parameters being required. I have rewritten the method as:
SplitStr(item(),stream," ",41,5) per the editor help: SplitStr ( SplitResult, SearchString, FilterString, NumSplit, SplitOption )
This works but there are not always NumSplit values resulting from the splitting.
A sample value for stream is "wind_speed 4.5 wind_direction 271 humidity 73 air_temperature 1.6" so I would expect numparms to equal 7 before the change.
So the question is what is the best, most efficient way to determine how many splits were found in order to assign a value to "numparms" for the loop to work?
Thanks in advance!
More info. The previous OS version should have been 8.2.1.
I am surprised the older OS let it compile without the NumSplit and SplitOption parameters. Those have always been required parameters. Last change to SplitStr() was OS 6, which added support for data structures.
You did not share what value you are using for SplitOption. I suggest either 4 or 5. Use 5 (FOOTERFILTER) if you want to include the value from before the first space in your output array.