I am looking for help or code examples on how to extract a series of numbers in a string that are always seperated by a "white space".
The following code example worked fine when I knew that the numbers were always going to be 2 bytes long, using the ProcommPlus "substr" command.
Now the program needs to be modified to support numbers in a character string with variable lentgh sizes of 1, 2 or 3 bytes.
integer TempStrIndex = 0 ; for Temp Status module
string TempStatOutputStr[3] ; for Temp Status module
string TempStatStrArr[3][4] ; for Temp Status module
integer TempStatIntArr[3][4] ; for Temp Status module
integer TempHiLimit = 0 ; for Temp Status module
integer TempLoLimit = 0 ; for Temp Status module
ArrIndex = 0, ArrIndex2 = 3
TempStatStrArr[ArrIndex][ArrIndex2] = TempStatOutputStrArrIndex]
substr TempStatStrArr[1][0] TempStatOutputStr[1] 1 2
substr TempStatStrArr[1][1] TempStatOutputStr[1] 6 2
substr TempStatStrArr[1][2] TempStatOutputStr[1] 11 2
substr TempStatStrArr[1][3] TempStatOutputStr[1] 15 10
Can I use the "sizeof" parameter somehow to replace where
the "fixed number size = 2" value is in the substr command shown above ??
Best Regards, willy113
The following code example worked fine when I knew that the numbers were always going to be 2 bytes long, using the ProcommPlus "substr" command.
Now the program needs to be modified to support numbers in a character string with variable lentgh sizes of 1, 2 or 3 bytes.
integer TempStrIndex = 0 ; for Temp Status module
string TempStatOutputStr[3] ; for Temp Status module
string TempStatStrArr[3][4] ; for Temp Status module
integer TempStatIntArr[3][4] ; for Temp Status module
integer TempHiLimit = 0 ; for Temp Status module
integer TempLoLimit = 0 ; for Temp Status module
ArrIndex = 0, ArrIndex2 = 3
TempStatStrArr[ArrIndex][ArrIndex2] = TempStatOutputStrArrIndex]
substr TempStatStrArr[1][0] TempStatOutputStr[1] 1 2
substr TempStatStrArr[1][1] TempStatOutputStr[1] 6 2
substr TempStatStrArr[1][2] TempStatOutputStr[1] 11 2
substr TempStatStrArr[1][3] TempStatOutputStr[1] 15 10
Can I use the "sizeof" parameter somehow to replace where
the "fixed number size = 2" value is in the substr command shown above ??
Best Regards, willy113