You are reading a single comment by @d0773d and its replies. Click here to read the full conversation.
  • 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:

    If (e.data != "\r" || e.data != "\n") {
      phValue = e.data;
    }
    

    However, when I check the length of the phValue again I am still getting a length of 5.

About

Avatar for d0773d @d0773d started