I read through the reference section of this website and could not find a trim or some sort of replace function. The issue I am having is, my PH sensor responds with a float(ie 8.55) with a length of 5. I think the fifth character is a carriage return. I could not tell so I used String.charCodeAt(5) which responded back with a 13. How do I remove the \r or any none digit character from the end of the float value? Since the value is sent via serial communication I tried:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I read through the reference section of this website and could not find a trim or some sort of replace function. The issue I am having is, my PH sensor responds with a float(ie 8.55) with a length of 5. I think the fifth character is a carriage return. I could not tell so I used String.charCodeAt(5) which responded back with a 13. How do I remove the \r or any none digit character from the end of the float value? Since the value is sent via serial communication I tried:
However, when I check the length of the phValue again I am still getting a length of 5.