The function compares DEL with DEL\n\n and, since the strings are not equals, your function set the msg.payload = 0.
One possible solution could be to remove any new line character in your payload coming from the Tesseract node and then compare it with the "DEL" string. Adding the following line of code before your IF statement should do the job.
Thanks, I had just stumbled that by taking out the square brackets then it would check the whole string. So by playing around and for future reference the number in the bracket indicates the character in the string that is going to be compared. Is there any notation in that I can put in that bracket if I wanted to check say the first 3 characters of that string?
Strings are essentially 0 based char arrays (so mystring[1] accesses the 2nd character)
String are objects with many built in functions - 1 of them being substr. Check out the extensive online documentation which also has examples and a dynamic run-able demo where you can test things out & see what happens.