String.startsWith returning invalid results
cmd string. when use cmd.startswith(), returns false always, when check using serial port see right.
here serial output:
what missing? worked until recently. have been working on unrelated section of code.
please help, confused....
thanks,
josh hawley
code: [select]
serial.print("cmd=");
serial.println(cmd);
serial.print("cmd.startswith(\"fire:\")=");
serial.println(cmd.startswith("fire:"));
if (cmd.startswith("fire:")) <----------------------------- returns 0 always
{
cmd.replace("fire:","");
serial.print("entered fire:");
serial.println(cmd);
here serial output:
code: [select]
cmd=fire:a1999b1c1d9ef9gh9ij3kl9m1n1o1p1q1r1s1t
cmd.startswith("fire:")=0
what missing? worked until recently. have been working on unrelated section of code.
please help, confused....
thanks,
josh hawley
quote
this worked until recently.
that code should work.
as using strings, conscious of how ram have left? low ram can cause magical happen.
verify on stand alone sketch, basic functionality have posted above.
Arduino Forum > Using Arduino > Programming Questions > String.startsWith returning invalid results
arduino
Comments
Post a Comment