07-25-2007, 02:04 PM
str text="RED 626.217102 820.000000 461.000000 64.519341 2636.535645 447119.000000";;sameple string to be fed in by prior code
str pattern="\d{1,6}\.\d{6}";; regular expression pattern
ARRAY(str) result
findrx(text pattern 2 4 result);; puts each pattern match into a string array "result"
str volume.set(result[0 4]);; outputs the 5th (0, 1, 2, 3, 4) element of the array into the str "volume"
out volume
double volumeint=val(volume 2);; converts the string into a double variable
double volumeCCs=(volumeint*0.001);; converts from millileters to cubic centimeters of volume
out volumeCCs
VARIANT v.round(volumeCCs 3);; rounds to 3 decimal places
volumeCCs=v
out volumeCCs