1
I have a string that the Arduino sends to my application through the serial port with the following format:
variable = #value of ultrasound distance##value of ultrasound distance#...(with 10 samples equal to this one).
I need to separate only the numbers of this string, sum them together, calculate a simple average over these values stored this average in a variable and show in a textbox show the value.
If anyone can help, I’d appreciate it.
Regex r = new Regex(@"\d+"); Match m = r.Match(str);
– Guilherme Lautert
Oh no, regex no! : P Creates an answer, is a good alternative.
– Jéf Bueno
Yours is faster, outside that would be equal to yours, changing only the 3, 4 line, I will keep as comment, only as alternative, for those who like :D
– Guilherme Lautert